prometheus/web/ui/module/lezer-promql/test/promql.test.js
Augustin Husson 043a2954f8
UI: stabilize dependencies and environment (#10517)
* create lezer-promql module + move codemirror to a pure esm module + unified dependencies

Signed-off-by: Augustin Husson <[email protected]>

* ignore test utils file and remove the type "module" in package.json

Signed-off-by: Augustin Husson <[email protected]>

* use jest to run the lezer-promql test

Signed-off-by: Augustin Husson <[email protected]>

* give an automatic way to update the ui dependencies

Signed-off-by: Augustin Husson <[email protected]>

* update all dependencies using make update-npm-deps

Signed-off-by: Augustin Husson <[email protected]>

* fix react-app test

Signed-off-by: Augustin Husson <[email protected]>

* remove generated file

Signed-off-by: Augustin Husson <[email protected]>

* remove unnecessary backslash in script

Signed-off-by: Augustin Husson <[email protected]>

* fix reviews

Signed-off-by: Augustin Husson <[email protected]>

* rewording

Signed-off-by: Augustin Husson <[email protected]>

* use npx to run lezer-generator

Signed-off-by: Augustin Husson <[email protected]>
2022-04-05 11:49:22 +02:00

17 lines
554 B
JavaScript

import { parser } from '../dist/index.es.js';
import { fileTests } from '@lezer/generator/dist/test';
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
let caseDir = path.dirname(fileURLToPath(import.meta.url))
for (const file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue;
const name = /^[^.]*/.exec(file)[0];
describe(name, () => {
for (const { name, run } of fileTests(fs.readFileSync(path.join(caseDir, file), 'utf8'), file)) it(name, () => run(parser));
});
}