From 4676d43b25fa093daf68b446b7bed7a62d1083d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 3 Apr 2019 17:44:16 +0100 Subject: [PATCH 1/6] Fixes the test-sequencer resolution w/ pnp --- packages/jest-config/src/normalize.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 335b8c1e2293..8c7c62a34faa 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -478,6 +478,10 @@ export default function normalize( options.testRunner = require.resolve('jest-jasmine2'); } + if (!options.testSequencer) { + options.testSequencer = require.resolve('@jest/test-sequencer'); + } + if (!options.coverageDirectory) { options.coverageDirectory = path.resolve(options.rootDir, 'coverage'); } From 266d2c4513c56dd449e696cf1306b445c80c5967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 3 Apr 2019 17:52:13 +0100 Subject: [PATCH 2/6] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45f3986cd5fe..0945b50f0312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Fixes +- `[@jest/config]` Normalize `testSequencer` to its absolute path ([#8267](https://github.com/facebook/jest/pull/8267)) + ### Chore & Maintenance ### Performance From 3765d99f13aab3d166c7591dd72fbc2bb0f2a997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 3 Apr 2019 18:20:12 +0100 Subject: [PATCH 3/6] Update normalize.ts --- packages/jest-config/src/normalize.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 8c7c62a34faa..a8c60674a52b 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -478,10 +478,6 @@ export default function normalize( options.testRunner = require.resolve('jest-jasmine2'); } - if (!options.testSequencer) { - options.testSequencer = require.resolve('@jest/test-sequencer'); - } - if (!options.coverageDirectory) { options.coverageDirectory = path.resolve(options.rootDir, 'coverage'); } @@ -500,6 +496,11 @@ export default function normalize( }); } + newOptions.testSequencer = getSequencer(newOptions.resolver, { + rootDir: options.rootDir, + filePath: options.testSequencer || DEFAULT_CONFIG.testSequencer, + }); + const optionKeys = Object.keys(options) as Array; optionKeys.reduce((newOptions, key: keyof Config.InitialOptions) => { @@ -593,17 +594,6 @@ export default function normalize( }); } break; - case 'testSequencer': - { - const option = oldOptions[key]; - value = - option && - getSequencer(newOptions.resolver, { - filePath: option, - rootDir: options.rootDir, - }); - } - break; case 'prettierPath': { // We only want this to throw if "prettierPath" is explicitly passed From 40e7f1e864988e1c722345cf25eab427d68e3b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 3 Apr 2019 18:54:47 +0100 Subject: [PATCH 4/6] Update normalize.ts --- packages/jest-config/src/normalize.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index a8c60674a52b..78c7ed151352 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -497,8 +497,8 @@ export default function normalize( } newOptions.testSequencer = getSequencer(newOptions.resolver, { - rootDir: options.rootDir, filePath: options.testSequencer || DEFAULT_CONFIG.testSequencer, + rootDir: options.rootDir, }); const optionKeys = Object.keys(options) as Array; From 5e580e3d9853f9f616c309d775feccf45a3d7233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 3 Apr 2019 19:50:26 +0100 Subject: [PATCH 5/6] Fixes snapshot --- e2e/__tests__/__snapshots__/showConfig.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index 44f0f007f29a..dbafaaad3ca1 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -117,7 +117,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` "testFailureExitCode": 1, "testPathPattern": "", "testResultsProcessor": null, - "testSequencer": "@jest/test-sequencer", + "testSequencer": "<>/jest-test-sequencer/build/index.js", "updateSnapshot": "all", "useStderr": false, "verbose": null, From 2800f8be0cfe6d5963207bf1eb28d30a50b42483 Mon Sep 17 00:00:00 2001 From: Scott Hovestadt Date: Wed, 3 Apr 2019 14:47:35 -0700 Subject: [PATCH 6/6] Fix testSequencer value being overwritten by 'old style' of options. --- packages/jest-config/src/normalize.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 78c7ed151352..fa9c5fad1adf 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -496,11 +496,6 @@ export default function normalize( }); } - newOptions.testSequencer = getSequencer(newOptions.resolver, { - filePath: options.testSequencer || DEFAULT_CONFIG.testSequencer, - rootDir: options.rootDir, - }); - const optionKeys = Object.keys(options) as Array; optionKeys.reduce((newOptions, key: keyof Config.InitialOptions) => { @@ -877,6 +872,11 @@ export default function normalize( // ignored } + newOptions.testSequencer = getSequencer(newOptions.resolver, { + filePath: options.testSequencer || DEFAULT_CONFIG.testSequencer, + rootDir: options.rootDir, + }); + newOptions.nonFlagArgs = argv._; newOptions.testPathPattern = buildTestPathPattern(argv); newOptions.json = !!argv.json;