Skip to content

Commit a2a7930

Browse files
committed
Move Jest config from package.json to jest.config.js.
1 parent 147cecb commit a2a7930

File tree

2 files changed

+43
-33
lines changed

2 files changed

+43
-33
lines changed

jest.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
module.exports = {
6+
testMatch: ['<rootDir>/src/**/*.test.{js,jsx,ts,tsx}'],
7+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
8+
9+
testEnvironment: './src/test/custom-environment',
10+
setupFilesAfterEnv: [
11+
'jest-extended/all',
12+
'./src/test/setup.ts',
13+
],
14+
15+
collectCoverageFrom: [
16+
'src/**/*.{js,jsx,ts,tsx}',
17+
'!**/node_modules/**',
18+
'!src/types/libdef/**',
19+
],
20+
21+
// Transform ESM modules to CommonJS for Jest
22+
// These packages ship as pure ESM and need to be transformed by Babel
23+
transformIgnorePatterns: [
24+
'/node_modules/(?!(query-string|decode-uri-component|iongraph-web|split-on-first|filter-obj|fetch-mock)/)',
25+
],
26+
27+
// Mock static assets (images, CSS, etc.)
28+
moduleNameMapper: {
29+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ftl)$':
30+
'<rootDir>/src/test/fixtures/mocks/file-mock.ts',
31+
'\\.(css|less)$': '<rootDir>/src/test/fixtures/mocks/style-mock.ts',
32+
},
33+
34+
globals: {
35+
AVAILABLE_STAGING_LOCALES: null,
36+
},
37+
38+
snapshotFormat: {
39+
escapeString: true,
40+
printBasicPrototype: true,
41+
},
42+
verbose: false,
43+
};

package.json

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -194,39 +194,6 @@
194194
"@types/react-splitter-layout/@types/react": "^18.3.26",
195195
"@types/trusted-types": "^2.0.7"
196196
},
197-
"jest": {
198-
"collectCoverageFrom": [
199-
"src/**/*.{js,jsx,ts,tsx}",
200-
"!**/node_modules/**",
201-
"!src/types/libdef/**"
202-
],
203-
"moduleFileExtensions": [
204-
"js",
205-
"jsx",
206-
"ts",
207-
"tsx"
208-
],
209-
"transformIgnorePatterns": [
210-
"/node_modules/(?!(query-string|decode-uri-component|iongraph-web|split-on-first|filter-obj|fetch-mock)/)"
211-
],
212-
"moduleNameMapper": {
213-
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ftl)$": "<rootDir>/src/test/fixtures/mocks/file-mock.ts",
214-
"\\.(css|less)$": "<rootDir>/src/test/fixtures/mocks/style-mock.ts"
215-
},
216-
"setupFilesAfterEnv": [
217-
"jest-extended/all",
218-
"./src/test/setup.ts"
219-
],
220-
"globals": {
221-
"AVAILABLE_STAGING_LOCALES": null
222-
},
223-
"snapshotFormat": {
224-
"escapeString": true,
225-
"printBasicPrototype": true
226-
},
227-
"testEnvironment": "./src/test/custom-environment",
228-
"verbose": false
229-
},
230197
"husky": {
231198
"hooks": {
232199
"post-checkout": "node bin/post-checkout.js",

0 commit comments

Comments
 (0)