2023-05-25 02:40:08 +00:00
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [react()],
|
2023-06-07 02:37:10 +00:00
|
|
|
resolve: {
|
|
|
|
mainFields: ['module'],
|
|
|
|
},
|
2023-05-25 02:40:08 +00:00
|
|
|
test: {
|
|
|
|
globals: true,
|
|
|
|
setupFiles: 'scripts/setupVitest.ts',
|
|
|
|
environment: 'jsdom',
|
2023-06-07 02:37:10 +00:00
|
|
|
css: false,
|
2023-05-25 02:40:08 +00:00
|
|
|
threads: true,
|
|
|
|
alias: [
|
2023-06-07 07:42:57 +00:00
|
|
|
{ find: 'testUtils', replacement: 'testUtils.ts' },
|
2023-05-25 02:40:08 +00:00
|
|
|
{ find: '@nocobase/evaluators/client', replacement: 'packages/core/evaluators/src/client' },
|
|
|
|
{ find: '@nocobase/utils/client', replacement: 'packages/core/utils/src/client' },
|
2023-06-07 02:37:10 +00:00
|
|
|
{ find: /^~antd\/(.*)/, replacement: 'antd/$1' },
|
2023-05-25 02:40:08 +00:00
|
|
|
{ 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,
|
2023-06-07 02:37:10 +00:00
|
|
|
deps: {
|
|
|
|
inline: ['@juggle/resize-observer', 'clsx'],
|
|
|
|
},
|
2023-07-28 01:58:49 +00:00
|
|
|
// 在 GitHub Actions 中不输出日志
|
|
|
|
silent: !!process.env.GITHUB_ACTIONS,
|
2023-05-25 02:40:08 +00:00
|
|
|
},
|
|
|
|
});
|