nocobase2/vitest.config.ts
被雨水过滤的空气-Rairn 49117afb72
refactor: front-end testing with vitest (#1900)
* refactor: front-end testing with vitest

* fix: fix build failed
2023-05-25 10:40:08 +08:00

28 lines
1.2 KiB
TypeScript

import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [react()],
test: {
globals: true,
setupFiles: 'scripts/setupVitest.ts',
environment: 'jsdom',
css: true,
threads: true,
alias: [
{ find: '@nocobase/evaluators/client', replacement: 'packages/core/evaluators/src/client' },
{ find: '@nocobase/utils/client', replacement: 'packages/core/utils/src/client' },
{ find: /^@nocobase\/app-(.*)/, replacement: 'packages/$1/src' },
{ find: /^@nocobase\/plugin-sample-(.*)/, replacement: 'packages/samples/$1/src' },
{ find: /^@nocobase\/plugin-pro-(.*)/, replacement: 'packages/pro-plugins/$1/src' },
{ find: /^@nocobase\/plugin-(.*)/, replacement: 'packages/plugins/$1/src' },
{ find: /^@nocobase\/preset-(.*)/, replacement: 'packages/presets/$1/src' },
{ find: /^@nocobase\/(.*)/, replacement: 'packages/core/$1/src' },
],
include: ['packages/**/{dumi-theme-nocobase,sdk,client}/**/__tests__/**/*.{test,spec}.{ts,tsx}'],
exclude: ['**/node_modules/**', '**/dist/**', '**/lib/**', '**/es/**', '**/{vitest,commitlint}.config.*'],
testTimeout: 300000,
bail: 1,
},
});