Skip to content

Commit ec820c3

Browse files
authored
fix(jest-config): move json behind ts (#10572)
1 parent 33b8df1 commit ec820c3

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- `[expect]` [**BREAKING**] Make `toContain` more strict with the received type ([#10119](https://github.com/facebook/jest/pull/10119) & [#10929](https://github.com/facebook/jest/pull/10929))
2525
- `[jest-circus]` Fixed the issue of beforeAll & afterAll hooks getting executed even if it is inside a skipped `describe` block [#10451](https://github.com/facebook/jest/issues/10451)
2626
- `[jest-circus]` Fix `testLocation` on Windows when using `test.each` ([#10871](https://github.com/facebook/jest/pull/10871))
27+
- `[jest-config]` [**BREAKING**] Change default file extension order by moving json behind ts and tsx ([10572](https://github.com/facebook/jest/pull/10572))
2728
- `[jest-console]` `console.dir` now respects the second argument correctly ([#10638](https://github.com/facebook/jest/pull/10638))
2829
- `[jest-each]` [**BREAKING**] Ignore excess words in headings ([#8766](https://github.com/facebook/jest/pull/8766))
2930
- `[jest-environment-jsdom]` Use inner realm’s `ArrayBuffer` constructor ([#10885](https://github.com/facebook/jest/pull/10885))

docs/Configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ An array of directory names to be searched recursively up from the requiring mod
534534

535535
### `moduleFileExtensions` [array\<string>]
536536

537-
Default: `["js", "json", "jsx", "ts", "tsx", "node"]`
537+
Default: `["js", "jsx", "ts", "tsx", "json", "node"]`
538538

539539
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
540540

e2e/__tests__/__snapshots__/showConfig.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ exports[`--showConfig outputs config info and exits 1`] = `
2929
],
3030
"moduleFileExtensions": [
3131
"js",
32-
"json",
3332
"jsx",
3433
"ts",
3534
"tsx",
35+
"json",
3636
"node"
3737
],
3838
"moduleNameMapper": [],

packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ module.exports = {
191191
// An array of file extensions your modules use
192192
// moduleFileExtensions: [
193193
// \\"js\\",
194-
// \\"json\\",
195194
// \\"jsx\\",
196195
// \\"ts\\",
197196
// \\"tsx\\",
197+
// \\"json\\",
198198
// \\"node\\"
199199
// ],
200200

packages/jest-config/src/Defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const defaultOptions: Config.DefaultOptions = {
3737
maxConcurrency: 5,
3838
maxWorkers: '50%',
3939
moduleDirectories: ['node_modules'],
40-
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
40+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
4141
moduleNameMapper: {},
4242
modulePathIgnorePatterns: [],
4343
noStackTrace: false,

packages/jest-config/src/__tests__/normalize.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,10 +1605,10 @@ describe('moduleFileExtensions', () => {
16051605

16061606
expect(options.moduleFileExtensions).toEqual([
16071607
'js',
1608-
'json',
16091608
'jsx',
16101609
'ts',
16111610
'tsx',
1611+
'json',
16121612
'node',
16131613
]);
16141614
});

0 commit comments

Comments
 (0)