From c6794b3a12388b3671a3cbd989285625d8313a7b Mon Sep 17 00:00:00 2001 From: "jack.wu" Date: Fri, 2 Oct 2020 14:12:04 +0800 Subject: [PATCH 1/5] move json behind ts --- packages/jest-config/src/Defaults.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest-config/src/Defaults.ts b/packages/jest-config/src/Defaults.ts index 3ed8152dbd82..714460eb5de1 100644 --- a/packages/jest-config/src/Defaults.ts +++ b/packages/jest-config/src/Defaults.ts @@ -36,7 +36,7 @@ const defaultOptions: Config.DefaultOptions = { maxConcurrency: 5, maxWorkers: '50%', moduleDirectories: ['node_modules'], - moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'], + moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'], moduleNameMapper: {}, modulePathIgnorePatterns: [], noStackTrace: false, From f835c9dbcc0c82d4a1ebdb8c56baa7bd44c21cf3 Mon Sep 17 00:00:00 2001 From: "jack.wu" Date: Fri, 2 Oct 2020 16:16:47 +0800 Subject: [PATCH 2/5] add changeLog and update docs --- CHANGELOG.md | 1 + docs/Configuration.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95b3d0ec82d2..5c71076e2f20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Chore & Maintenance - `[jest-resolve]` Replace read-pkg-up with escalade package ([10558](https://github.com/facebook/jest/pull/10558)) +- `[jest-config]` Change default file extension order by moving json behind ts and tsx ([10572](https://github.com/facebook/jest/pull/10572)) ### Performance diff --git a/docs/Configuration.md b/docs/Configuration.md index 9e485fcafc34..0a4ca16e7e44 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -476,7 +476,7 @@ An array of directory names to be searched recursively up from the requiring mod ### `moduleFileExtensions` [array\] -Default: `["js", "json", "jsx", "ts", "tsx", "node"]` +Default: `["js", "jsx", "ts", "tsx", "json", "node"]` 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. From 919888f066deafbdbc8c2a52de890e0c6035bfd4 Mon Sep 17 00:00:00 2001 From: Jack Wu Date: Fri, 2 Oct 2020 21:06:58 +0800 Subject: [PATCH 3/5] Update CHANGELOG.md Co-authored-by: Simen Bekkhus --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c71076e2f20..c3e2f6f807e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ ### Chore & Maintenance - `[jest-resolve]` Replace read-pkg-up with escalade package ([10558](https://github.com/facebook/jest/pull/10558)) -- `[jest-config]` Change default file extension order by moving json behind ts and tsx ([10572](https://github.com/facebook/jest/pull/10572)) +- `[jest-config]` [**BREAKING**] Change default file extension order by moving json behind ts and tsx ([10572](https://github.com/facebook/jest/pull/10572)) ### Performance From 6187e85eaeebee36f58ba9e5563af5e70be67d62 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 22 Dec 2020 13:34:38 +0100 Subject: [PATCH 4/5] cleanup changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3468939a47b8..24ac70583279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -185,8 +185,6 @@ ### Chore & Maintenance - `[jest-resolve]` Replace read-pkg-up with escalade package ([10558](https://github.com/facebook/jest/pull/10558)) - -### Performance - `[jest-environment-jsdom]` Update jsdom to 16.4.0 ([10578](https://github.com/facebook/jest/pull/10578)) ## 26.4.2 From 986db9143ff8d498a5ae278af8967e6d96c7f028 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 22 Dec 2020 14:24:08 +0100 Subject: [PATCH 5/5] snaps --- e2e/__tests__/__snapshots__/showConfig.test.ts.snap | 2 +- .../jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap | 2 +- packages/jest-config/src/__tests__/normalize.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index 431d672a7322..f69f806a639c 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -29,10 +29,10 @@ exports[`--showConfig outputs config info and exits 1`] = ` ], "moduleFileExtensions": [ "js", - "json", "jsx", "ts", "tsx", + "json", "node" ], "moduleNameMapper": [], diff --git a/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap b/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap index 05ec66cc3afc..40c0b966b6c1 100644 --- a/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap +++ b/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap @@ -191,10 +191,10 @@ module.exports = { // An array of file extensions your modules use // moduleFileExtensions: [ // \\"js\\", - // \\"json\\", // \\"jsx\\", // \\"ts\\", // \\"tsx\\", + // \\"json\\", // \\"node\\" // ], diff --git a/packages/jest-config/src/__tests__/normalize.test.js b/packages/jest-config/src/__tests__/normalize.test.js index c7fc0974bb3b..a9963f31f0f2 100644 --- a/packages/jest-config/src/__tests__/normalize.test.js +++ b/packages/jest-config/src/__tests__/normalize.test.js @@ -1605,10 +1605,10 @@ describe('moduleFileExtensions', () => { expect(options.moduleFileExtensions).toEqual([ 'js', - 'json', 'jsx', 'ts', 'tsx', + 'json', 'node', ]); });