test: improve easy-ast test performance

This commit is contained in:
Wieland Schöbl
2021-08-25 10:25:34 +00:00
parent 7238c2f333
commit c5a8f7ebea

View File

@@ -19,16 +19,15 @@ import {expect} from 'chai';
import {omitBy} from 'lodash';
describe('Easy AST', async () => {
const project = lightweightProjectFromPath('./test/easy-ast', true);
for (const file of expandPathToFilesSync('./test/easy-ast', file => file.endsWith('ast-test.ts'))) {
try {
const test = (await import(file))['testConfig'] as EasyAstSpecType;
it(test.testName, () => {
const project = omitBy(lightweightProjectFromPath(file, true)[toUnixPath(file)], (_value, key) =>
key.startsWith('$'),
expect(omitBy(project[toUnixPath(file)], (_value, key) => key.startsWith('$'))).to.be.deep.equal(
test.expected,
);
expect(project).to.be.deep.equal(test.expected);
});
} catch (error) {
console.error(error);