test: migrate test runner to vitest (#12206)

This commit is contained in:
neverland
2023-08-20 18:48:09 +08:00
committed by GitHub
parent 633e48a645
commit 694daef6ea
374 changed files with 38189 additions and 31347 deletions
+30
View File
@@ -0,0 +1,30 @@
import { defineConfig } from 'vitest/config';
import vitePluginVue from '@vitejs/plugin-vue';
import vitePluginJsx from '@vitejs/plugin-vue-jsx';
import { cpus } from 'os';
const cpuNum = Math.max(cpus().length - 1, 1);
export default defineConfig({
test: {
globals: true,
coverage: {
include: ['src/**/*.[jt]s?(x)'],
exclude: [
'src/lazyload/vue-lazyload/**',
'**/demo/**',
'**/test/**',
'**/lang/**',
],
reporter: ['html', 'lcov', 'text-summary'],
reportsDirectory: './test/coverage',
},
environment: 'jsdom',
include: ['src/**/*.spec.[jt]s?(x)'],
restoreMocks: true,
experimentalVmThreads: true,
// limit the memory to avoid OOM
experimentalVmWorkerMemoryLimit: Math.min(1 / (cpuNum * 2), 0.1),
},
plugins: [vitePluginVue(), vitePluginJsx()],
});