-
Notifications
You must be signed in to change notification settings - Fork 4k
/
jest.config.js
53 lines (51 loc) · 1.46 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
/**
* 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,ts,tsx}' ).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/is-gutenberg-plugin.js',
],
setupFilesAfterEnv: [ '<rootDir>/test/unit/config/testing-library.js' ],
testURL: 'http://localhost',
testPathIgnorePatterns: [
'/.git/',
'/node_modules/',
'/packages/e2e-tests',
'/packages/e2e-test-utils-playwright/src/test.ts',
'<rootDir>/.*/build/',
'<rootDir>/.*/build-module/',
'<rootDir>/.*/build-types/',
'<rootDir>/.+.d.ts$',
'<rootDir>/.+.native.js$',
'/packages/react-native-*',
],
transform: {
'^.+\\.[jt]sx?$': '<rootDir>/test/unit/scripts/babel-transformer.js',
},
transformIgnorePatterns: [ 'node_modules/(?!(is-plain-obj))' ],
snapshotSerializers: [
'enzyme-to-json/serializer',
'@emotion/jest/serializer',
'snapshot-diff/serializer',
],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
reporters: [
'default',
'<rootDir>packages/scripts/config/jest-github-actions-reporter/index.js',
],
};