-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
jest.config.js
66 lines (64 loc) · 1.75 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
/**
* 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',
'.+\\.wasm$': '<rootDir>/test/unit/config/wasm-stub.js',
},
preset: '@wordpress/jest-preset-default',
setupFiles: [
'<rootDir>/test/unit/config/global-mocks.js',
'<rootDir>/test/unit/config/gutenberg-env.js',
],
setupFilesAfterEnv: [
'<rootDir>/test/unit/config/testing-library.js',
'<rootDir>/test/unit/mocks/match-media.js',
],
testEnvironmentOptions: {
url: '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-*',
],
resolver: '<rootDir>/test/unit/scripts/resolver.js',
transform: {
'^.+\\.[jt]sx?$': '<rootDir>/test/unit/scripts/babel-transformer.js',
},
transformIgnorePatterns: [
'/node_modules/(?!(docker-compose|yaml|preact|@preact|parsel-js)/)',
'\\.pnp\\.[^\\/]+$',
],
snapshotSerializers: [
'@emotion/jest/serializer',
'snapshot-diff/serializer',
],
snapshotFormat: {
escapeString: false,
printBasicPrototype: false,
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
reporters: [
'default',
'<rootDir>packages/scripts/config/jest-github-actions-reporter/index.js',
],
};