forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
32 lines (32 loc) · 1.08 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const ts = require('typescript');
const ps = require('path');
const tsConfig = ts.readConfigFile(ps.join(__dirname, 'tsconfig.json'), ts.sys.readFile);
if (!tsConfig.config) {
throw new Error(`Failed to read tsconfig`);
}
const { compilerOptions } = tsConfig.config;
module.exports = {
testEnvironment: './tests/test-environment.ts',
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: `${__dirname}/` }),
transformIgnorePatterns: [
// ignore everything in the node_modules EXCEPT for:
// - @cocos/dragonbones-js
'node_modules/(?!(@cocos/dragonbones-js)/)',
'native/external/emscripten/',
],
setupFilesAfterEnv: [
"./tests/setup-after-env.ts",
"./tests/utils/log-capture-setup-after-env.ts"
],
setupFiles: [
'./tests/init.ts',
],
coverageDirectory: './test/report/',
globals: {
CC_DEV: true,
CC_TEST: true,
CC_PHYSICS_BUILTIN: true,
}
};