2022-10-14 07:36:16 -06:00
|
|
|
import {defineConfig} from 'vitest/dist/config.js';
|
2022-12-20 15:15:47 -07:00
|
|
|
import {readFile} from 'node:fs/promises';
|
2022-10-14 07:36:16 -06:00
|
|
|
import {dataToEsm} from '@rollup/pluginutils';
|
2022-12-20 15:15:47 -07:00
|
|
|
import {extname} from 'node:path';
|
2023-04-01 06:57:05 -06:00
|
|
|
import vue from '@vitejs/plugin-vue';
|
2022-10-14 07:36:16 -06:00
|
|
|
|
|
|
|
function stringPlugin() {
|
|
|
|
return {
|
|
|
|
name: 'string-plugin',
|
|
|
|
enforce: 'pre',
|
|
|
|
async load(id) {
|
|
|
|
const path = id.split('?')[0];
|
|
|
|
if (extname(path) !== '.svg') return null;
|
|
|
|
return dataToEsm(await readFile(path, 'utf8'));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
test: {
|
|
|
|
include: ['web_src/**/*.test.js'],
|
|
|
|
setupFiles: ['./web_src/js/test/setup.js'],
|
|
|
|
environment: 'jsdom',
|
|
|
|
testTimeout: 20000,
|
|
|
|
open: false,
|
|
|
|
allowOnly: true,
|
|
|
|
passWithNoTests: true,
|
|
|
|
watch: false,
|
2023-04-19 20:36:41 -06:00
|
|
|
outputDiffLines: Infinity,
|
2022-10-14 07:36:16 -06:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
stringPlugin(),
|
2023-04-01 06:57:05 -06:00
|
|
|
vue(),
|
2022-10-14 07:36:16 -06:00
|
|
|
],
|
|
|
|
});
|