Fix unit test coverage

This commit is contained in:
Sidharth Vinod
2022-09-22 15:45:44 +05:30
parent d6245fdbda
commit 1c4eeb2d53
2 changed files with 3 additions and 38 deletions

View File

@@ -1,38 +0,0 @@
import { Generator } from 'jison';
import { defineConfig } from 'vitest/config';
const fileRegex = /\.jison$/;
/** Transforms jison to js. */
export function jisonPlugin() {
return {
name: 'transform-jison',
transform(src: string, id: string) {
if (fileRegex.test(id)) {
// eslint-disable-next-line no-console
console.log('Transforming', id);
return {
// @ts-ignore no typings for jison
code: new Generator(src, { 'token-stack': true }).generate(),
map: null, // provide source map if available
};
}
},
};
}
export default defineConfig({
resolve: {
extensions: ['.jison', '.js', '.ts', '.json'],
},
plugins: [jisonPlugin()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['src/tests/setup.ts'],
coverage: {
reporter: ['text', 'json', 'html', 'lcov'],
},
},
});

View File

@@ -10,5 +10,8 @@ export default defineConfig({
environment: 'jsdom',
globals: true,
setupFiles: ['src/tests/setup.ts'],
coverage: {
reporter: ['text', 'json', 'html', 'lcov'],
},
},
});