-
Notifications
You must be signed in to change notification settings - Fork 4k
/
jest.config.js
43 lines (41 loc) · 1.14 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
/**
* External dependencies
*/
const glob = require( 'glob' ).sync;
// Finds all packages which are transpiled with Babel to force Jest to use their source code.
const transpiledPackageNames = glob( 'packages/*/src/index.js' ).map(
( fileName ) => fileName.split( '/' )[ 1 ]
);
module.exports = {
rootDir: '../../',
moduleNameMapper: {
[ `@wordpress\\/(${ transpiledPackageNames.join(
'|'
) })$` ]: 'packages/$1/src',
},
preset: '@wordpress/jest-preset-default',
setupFiles: [
'<rootDir>/test/unit/config/global-mocks.js',
'<rootDir>/test/unit/config/gutenberg-phase.js',
'<rootDir>/test/unit/config/register-context.js',
],
testURL: 'http:https://localhost',
testPathIgnorePatterns: [
'/.git/',
'/node_modules/',
'/packages/e2e-tests',
'<rootDir>/wordpress/',
'<rootDir>/.*/build/',
'<rootDir>/.*/build-module/',
'<rootDir>/.+.native.js$',
'/packages/react-native-*',
],
transform: {
'^.+\\.[jt]sx?$': '<rootDir>/test/unit/scripts/babel-transformer.js',
},
snapshotSerializers: [ 'enzyme-to-json/serializer', 'jest-emotion' ],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
};