-
Notifications
You must be signed in to change notification settings - Fork 392
/
jest.config.js
86 lines (85 loc) · 2.89 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// https://jestjs.io/docs/configuration
const { defaults } = require('jest-config');
const util = require('node:util');
const exec = util.promisify(require('node:child_process').exec);
module.exports = async () => {
const { stdout } = await exec('yarn config get cacheFolder');
const cacheDirectory = stdout.trim().replace('\n', '');
return {
// ts-jest, react-native, jest-expo, jest-expo/web,
preset: 'jest-expo/web', // require *.web.ts, do not require *.native.ts
coverageProvider: 'v8',
cacheDirectory: `${cacheDirectory}/.app-mono-jest-cache`,
setupFilesAfterEnv: [
'./jest-setup.js',
'./node_modules/react-native-gesture-handler/jestSetup.js',
],
// buffer type incorrect if use [jsdom] https://github.com/facebook/jest/issues/4422
// jest-environment-node, node, jsdom
testEnvironment: 'jest-environment-node',
verbose: true,
moduleFileExtensions: [
...defaults.moduleFileExtensions,
'd.ts',
'jest.ts', // not working
'jest.tsx',
'ts',
'tsx',
],
// 'extensionsToTreatAsEsm': ['.wasm', '.ts'],
moduleNameMapper: {
// '^(\\.{1,2}/.*/cardano_message_signing_bg\\.wasm\\.js)$': '$1',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
'@onekeyhq/components': '<rootDir>/__mocks__/componentsMock.ts',
'@emurgo/cardano-serialization-lib-browser':
'@emurgo/cardano-serialization-lib-nodejs',
'@emurgo/cardano-message-signing-browser':
'@emurgo/cardano-message-signing-nodejs',
'\\./adaWebSdk$':
'<rootDir>/packages/core/src/chains/ada/sdkAda/sdk/adaWebSdk.jest.ts',
'^lodash-es$': 'lodash',
},
// TODO unify with transpile modules
transformIgnorePatterns: ['nodo_modules/react-native-reanimated'],
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
'diagnostics': {
warnOnly: true,
},
},
],
},
reporters: [
'default',
[
'./node_modules/jest-html-reporter',
{
'pageTitle': 'Test Report',
},
],
],
testPathIgnorePatterns: [
'packages/core/src/chains/ada',
'packages/core/src/chains/algo',
'packages/core/src/chains/apt',
'packages/core/src/chains/bch',
'packages/core/src/chains/cfx',
'packages/core/src/chains/doge',
'packages/core/src/chains/dot',
'packages/core/src/chains/fil',
'packages/core/src/chains/kaspa',
'packages/core/src/chains/ltc',
'packages/core/src/chains/near',
'packages/core/src/chains/nexa',
'packages/core/src/chains/sol',
'packages/core/src/chains/stc',
'packages/core/src/chains/tron',
'packages/core/src/chains/xmr',
'packages/core/src/chains/xrp',
],
};
};