Merge vitest

This commit is contained in:
Sidharth Vinod
2022-09-20 23:51:21 +05:30
parent e0aae3e31f
commit 3b30232e88
27 changed files with 657 additions and 1660 deletions

35
vite.config.ts Normal file
View File

@@ -0,0 +1,35 @@
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'],
},
});