forked from woocommerce/google-listings-and-ads
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
59 lines (58 loc) · 1.68 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
// Import WP-scripts presets to extend them,
// see https://developer.wordpress.org/block-editor/packages/packages-scripts/#advanced-information-11.
const defaultConfig = require( '@wordpress/scripts/config/jest-unit.config' );
module.exports = {
...defaultConfig,
testEnvironment: 'jsdom',
setupFiles: [ 'core-js', '<rootDir>/js/src/tests/jest-unit.setup.js' ],
transformIgnorePatterns: [
// Fix that `[email protected]` doesn't provide the CommonJS build, so it needs to be transformed.
'<rootDir>/node_modules/(?!is-plain-obj/)',
],
moduleNameMapper: {
'\\.(png|jpg)$': '<rootDir>/tests/mocks/assets/imageMock.js',
'\\.svg$': '<rootDir>/tests/mocks/assets/svgrMock.js',
'\\.scss$': '<rootDir>/tests/mocks/assets/styleMock.js',
// Transform our `.~/` alias.
'^\\.~/(.*)$': '<rootDir>/js/src/$1',
'@woocommerce/settings':
'<rootDir>/js/src/tests/dependencies/woocommerce/settings',
'@automattic/calypso-config':
'<rootDir>/js/src/tests/dependencies/automattic/calypso-config',
},
// Exclude e2e tests from unit testing.
testPathIgnorePatterns: [
'/node_modules/',
'/__helpers__/',
'<rootDir>/tests/e2e/',
],
coveragePathIgnorePatterns: [
'/node_modules/',
'/__helpers__/',
'<rootDir>/tests/',
],
watchPathIgnorePatterns: [
'<rootDir>/.externalized.json',
'<rootDir>/js/build/',
'<rootDir>/js/build-dev',
],
globals: {
wcAdminFeatures: {
navigation: false,
},
glaData: {
slug: 'gla',
mcSetupComplete: true,
mcSupportedCountry: true,
mcSupportedLanguage: true,
adsSetupComplete: true,
enableReports: true,
dateFormat: 'F j, Y',
timeFormat: 'g:i a',
initialWpData: {
version: '1.2.3',
},
},
},
timers: 'fake',
};