3b7c1345cc
* test: add tests for lazy loading of association fields * refactor: migrate * test: add tests for page * test: add tests for page menu * test: add tests for tabs * test: add tests for detail block * test: add tests for list block * test: add tests for grid card block * test: add tests for filter collapse block * test: add tests for markdown block * test: add tests for table block * test: add tests for table block * test: add tests for lazy loading of association fields * test: add tests for data scope * test: add tests for filter block * test: add tests for block template * test: add tests for drag and sorting * test: add tests for sorting rules * test: make testing more stable * Revert "test: make testing more stable" This reverts commit 78b7badeb65bfc603fb746efbdb8e242a763ae6a. * perf: remove enableToConfig * test: make testing more stable * test: make testing more stable * test: delete newly created records to make tests more stable * fix: fix error when deleting records * test: make testing more stable * test: make testing more stable * test: fix tests * refactor: optimize file structure * test: fix tests * test: fix tests * refactor: optimize description * refactor: optimize description * refactor: use __e2e__ as the root directory for test files * fix: fix build * test: make testing more stable
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import react from '@vitejs/plugin-react';
|
|
import { defineConfig } from 'vitest/config';
|
|
import tsConfigPaths from './tsconfig.paths.json';
|
|
|
|
const paths = tsConfigPaths.compilerOptions.paths;
|
|
|
|
const alias = Object.keys(paths).reduce<{ find: string; replacement: string }[]>((acc, key) => {
|
|
if (key !== '@@/*') {
|
|
const value = paths[key][0];
|
|
acc.push({
|
|
find: key,
|
|
replacement: value,
|
|
});
|
|
}
|
|
return acc;
|
|
}, []);
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
mainFields: ['module'],
|
|
},
|
|
define: {
|
|
'process.env.__TEST__': true,
|
|
'process.env.__E2E__': false,
|
|
},
|
|
test: {
|
|
globals: true,
|
|
setupFiles: 'scripts/vitest.setup.ts',
|
|
environment: 'jsdom',
|
|
css: false,
|
|
threads: true,
|
|
alias: [
|
|
{ find: 'testUtils', replacement: 'testUtils.ts' },
|
|
{ find: /^~antd\/(.*)/, replacement: 'antd/$1' },
|
|
...alias,
|
|
],
|
|
include: ['packages/**/{dumi-theme-nocobase,sdk,client,utils}/**/__tests__/**/*.{test,spec}.{ts,tsx}'],
|
|
exclude: [
|
|
'**/node_modules/**',
|
|
'**/dist/**',
|
|
'**/lib/**',
|
|
'**/es/**',
|
|
'**/e2e/**',
|
|
'**/__e2e__/**',
|
|
'**/{vitest,commitlint}.config.*',
|
|
],
|
|
testTimeout: 300000,
|
|
bail: 1,
|
|
// 在 GitHub Actions 中不输出日志
|
|
silent: !!process.env.GITHUB_ACTIONS,
|
|
server: {
|
|
deps: {
|
|
inline: ['@juggle/resize-observer', 'clsx'],
|
|
},
|
|
},
|
|
},
|
|
});
|