mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 05:36:05 +00:00
49117afb72
* refactor: front-end testing with vitest * fix: fix build failed
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const { pathsToModuleNameMapper } = require('ts-jest/utils');
|
|
const { compilerOptions } = require('./tsconfig.json');
|
|
const { defaults } = require('jest-config');
|
|
|
|
module.exports = {
|
|
rootDir: process.cwd(),
|
|
collectCoverage: false,
|
|
verbose: true,
|
|
testEnvironment: 'jsdom',
|
|
preset: 'ts-jest',
|
|
testMatch: ['**/__tests__/**/*.test.[jt]s'],
|
|
setupFiles: ['./jest.setup.ts'],
|
|
setupFilesAfterEnv: [require.resolve('jest-dom/extend-expect'), './jest.setupAfterEnv.ts'],
|
|
moduleNameMapper: {
|
|
...pathsToModuleNameMapper(compilerOptions.paths, {
|
|
prefix: '<rootDir>/',
|
|
}),
|
|
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
|
|
},
|
|
globals: {
|
|
'ts-jest': {
|
|
babelConfig: false,
|
|
tsconfig: './tsconfig.jest.json',
|
|
diagnostics: false,
|
|
},
|
|
},
|
|
modulePathIgnorePatterns: ['/esm/', '/es/', '/dist/', '/lib/', '/client/', '/sdk/', '\\.test\\.tsx$'],
|
|
// add .mjs .cjs for formula.js
|
|
moduleFileExtensions: [...defaults.moduleFileExtensions, 'mjs', 'cjs'],
|
|
coveragePathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'/__tests__/',
|
|
'/esm/',
|
|
'/lib/',
|
|
'package.json',
|
|
'/demo/',
|
|
'package-lock.json',
|
|
],
|
|
};
|