-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.ts
61 lines (54 loc) · 2.37 KB
/
jest.config.ts
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
import type { Config } from 'jest';
// List of node_module packages that will be transformed by jest
const packagesRegexToTransform = [
// Existing packages migrated from package.json::jest.transformIgnorePatterns
'@?(jest-)?react-native(-community)?',
'@?expo(nent)?',
'@expo-google-fonts',
'@react-navigation',
'@unimodules',
'native-base',
'react-native-svg',
'argon2',
/*
/home/dev/Documents/Git/Tonomy/Tonomy-ID/node_modules/multiformats/dist/src/basics.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import * as base10 from './bases/base10.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
*/
'@veramo',
'@ipld/dag-pb',
'multiformats',
'ipfs-unixfs',
'protons-runtime',
'uint8-varint',
'uint8arrays',
'expo-modules-core',
/*
/home/dev/Documents/Git/Tonomy/Tonomy-ID/node_modules/expo-sqlite/build/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export * from './SQLite';
^^^^^^
SyntaxError: Unexpected token 'export'
*/
'expo-sqlite',
];
// One big regex string to ignore several packages from not being transformed
// Aka these ARE transformed (despite normally being ignored because they are in node_modules)
const ignoreRegexString = 'node_modules/(?!(' + packagesRegexToTransform.join('|') + ')/.*)';
console.info('jest.transformIgnorePatterns:', ignoreRegexString);
const config: Config = {
preset: 'jest-expo',
transformIgnorePatterns: [ignoreRegexString],
testEnvironment: 'node',
moduleNameMapper: {
// Cannot find module ... from ...
'^@ipld/dag-pb$': '<rootDir>/node_modules/@ipld/dag-pb/src/index.js',
'^multiformats/(.*)$': '<rootDir>/node_modules/multiformats/esm/src/$1',
'^ipfs-unixfs$': '<rootDir>/node_modules/ipfs-unixfs/dist/src/index.js',
'^protons-runtime$': '<rootDir>/node_modules/protons-runtime/dist/src/index.js',
'^uint8-varint$': '<rootDir>/node_modules/uint8-varint/dist/src/index.js',
'^uint8arrays$': '<rootDir>/node_modules/uint8arrays/index.js',
},
setupFiles: ['./jest.setup.js'],
};
export default config;