nocobase/jest.config.js
ChengLei Shao 02559b61ba
feat(ci): run backend tests concurrently (#2815)
* chore: run backend tests concurrently

* fix: mock app server create database

* chore: using @swc/jest instead of ts-jest

* chore: create test database

* chore: database distributor

* fix: test collection manager

* fix: test

* chore: to  use Jest.mock, change the formatter to the commonjs module

* chore: db acquire

* chore: github action

* fix: pg test action

* chore: formatter

* chore: jest workaround

* fix: mysql test

* chore: mysql github action

* chore: clean storage

* chore: gitignore

* chore: max workers
2023-10-17 22:22:45 +08:00

47 lines
1.1 KiB
JavaScript

const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig.paths.json');
const swcrc = {
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
decorators: true,
dynamicImport: false,
},
},
};
((swcrc.jsc ??= {}).experimental ??= {}).plugins = [['jest_workaround', {}]];
const config = {
rootDir: process.cwd(),
collectCoverage: false,
verbose: true,
preset: 'ts-jest',
testMatch: ['**/__tests__/**/*.test.[jt]s'],
setupFiles: ['./jest.setup.ts'],
setupFilesAfterEnv: ['./jest.setupAfterEnv.ts'],
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
},
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest', swcrc],
},
modulePathIgnorePatterns: ['/esm/', '/es/', '/dist/', '/lib/', '/client/', '/sdk/', '\\.test\\.tsx$'],
coveragePathIgnorePatterns: [
'/node_modules/',
'/__tests__/',
'/esm/',
'/lib/',
'package.json',
'/demo/',
'package-lock.json',
'/storage/',
],
};
module.exports = config;