From 7f1d15864781f2853c37e919191354ec70fd82a4 Mon Sep 17 00:00:00 2001 From: Charles Stover Date: Sat, 20 Nov 2021 17:31:52 -0800 Subject: [PATCH 1/6] Update package.json --- packages/jest-config/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index fed06d4f0b5f..12393ef05f4a 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -42,7 +42,8 @@ "jest-util": "^27.3.1", "jest-validate": "^27.3.1", "micromatch": "^4.0.4", - "pretty-format": "^27.3.1" + "pretty-format": "^27.3.1", + "slash": "^4.0.0" }, "devDependencies": { "@types/babel__core": "^7.0.4", From 6ca9c36b5d22564e6229cbbb05a6d22d07deded0 Mon Sep 17 00:00:00 2001 From: Charles Stover Date: Tue, 23 Nov 2021 14:23:11 -0800 Subject: [PATCH 2/6] update changelog and yarn lockfile --- CHANGELOG.md | 1 + yarn.lock | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 388e3585043e..dc106e5172cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes - `[expect]` Allow again `expect.Matchers` generic with single value ([#11986](https://github.com/facebook/jest/pull/11986)) +- `[jest-config]` Add missing `slash` dependency to `package.json` ([#12080](https://github.com/facebook/jest/pull/12080)) - `[jest-core]` Incorrect detection of open ZLIB handles ([#12022](https://github.com/facebook/jest/pull/12022)) - `[jest-diff]` Break dependency cycle ([#10818](https://github.com/facebook/jest/pull/10818)) - `[jest-environment-jsdom]` Add `@types/jsdom` dependency ([#11999](https://github.com/facebook/jest/pull/11999)) diff --git a/yarn.lock b/yarn.lock index 39519c873823..550e6aaf9bee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12658,6 +12658,7 @@ fsevents@^1.2.7: micromatch: ^4.0.4 pretty-format: ^27.3.1 semver: ^7.3.5 + slash: ^4.0.0 strip-ansi: ^6.0.0 ts-node: ^9.0.0 typescript: ^4.0.3 @@ -19641,6 +19642,13 @@ react-native@0.64.0: languageName: node linkType: hard +"slash@npm:^4.0.0": + version: 4.0.0 + resolution: "slash@npm:4.0.0" + checksum: 714b10473dd5efce5ebaad47c74d69201baf7715fa58e8049d3d2716d9da25a9571bfd3ecc50c3b7f4165948e2d8d5a1aa7faeaeca4891ee71a2fbd408268091 + languageName: node + linkType: hard + "slice-ansi@npm:^2.0.0": version: 2.1.0 resolution: "slice-ansi@npm:2.1.0" From cd2271175f37af933a380bbf48f8c505ba6c04d2 Mon Sep 17 00:00:00 2001 From: Charles Stover Date: Tue, 23 Nov 2021 15:07:17 -0800 Subject: [PATCH 3/6] change slash import style to fix TS build --- packages/jest-config/src/resolveConfigPath.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest-config/src/resolveConfigPath.ts b/packages/jest-config/src/resolveConfigPath.ts index 0f1439197a36..b8759af6d86a 100644 --- a/packages/jest-config/src/resolveConfigPath.ts +++ b/packages/jest-config/src/resolveConfigPath.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import chalk = require('chalk'); import * as fs from 'graceful-fs'; -import slash = require('slash'); +import slash from 'slash'; import type {Config} from '@jest/types'; import { JEST_CONFIG_BASE_NAME, From 208a9456683cc7c960da53803b535a14dfebcb59 Mon Sep 17 00:00:00 2001 From: Charles Stover Date: Tue, 23 Nov 2021 15:36:18 -0800 Subject: [PATCH 4/6] reference slash as slash.default --- packages/jest-config/src/resolveConfigPath.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jest-config/src/resolveConfigPath.ts b/packages/jest-config/src/resolveConfigPath.ts index b8759af6d86a..01279953a732 100644 --- a/packages/jest-config/src/resolveConfigPath.ts +++ b/packages/jest-config/src/resolveConfigPath.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import chalk = require('chalk'); import * as fs from 'graceful-fs'; -import slash from 'slash'; +import slash = require('slash'); import type {Config} from '@jest/types'; import { JEST_CONFIG_BASE_NAME, @@ -147,7 +147,7 @@ const makeMultipleConfigsWarning = (configPaths: Array) => chalk.bold('\u25cf Multiple configurations found:'), ...configPaths.map( configPath => - ` * ${extraIfPackageJson(configPath)}${slash(configPath)}`, + ` * ${extraIfPackageJson(configPath)}${slash.default(configPath)}`, ), '', ' Implicit config resolution does not allow multiple configuration files.', From bde363983c407a428d92f7405fa26b7c89ce2a40 Mon Sep 17 00:00:00 2001 From: Charles Stover Date: Tue, 23 Nov 2021 16:25:16 -0800 Subject: [PATCH 5/6] Override TS definition for slash. --- packages/jest-config/src/resolveConfigPath.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/jest-config/src/resolveConfigPath.ts b/packages/jest-config/src/resolveConfigPath.ts index 01279953a732..61d99bf1aa8f 100644 --- a/packages/jest-config/src/resolveConfigPath.ts +++ b/packages/jest-config/src/resolveConfigPath.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import chalk = require('chalk'); import * as fs from 'graceful-fs'; -import slash = require('slash'); +import slashModule = require('slash'); import type {Config} from '@jest/types'; import { JEST_CONFIG_BASE_NAME, @@ -21,6 +21,10 @@ const isFile = (filePath: Config.Path) => const getConfigFilename = (ext: string) => JEST_CONFIG_BASE_NAME + ext; +// Fix incorrect TypeScript definition for `slash` package. +const slash: typeof slashModule.default = + slashModule as unknown as typeof slashModule.default; + export default ( pathToResolve: Config.Path, cwd: Config.Path, @@ -147,7 +151,7 @@ const makeMultipleConfigsWarning = (configPaths: Array) => chalk.bold('\u25cf Multiple configurations found:'), ...configPaths.map( configPath => - ` * ${extraIfPackageJson(configPath)}${slash.default(configPath)}`, + ` * ${extraIfPackageJson(configPath)}${slash(configPath)}`, ), '', ' Implicit config resolution does not allow multiple configuration files.', From 555d41f0ac4cffb56569aec8dfc1d0d498d317b3 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 24 Nov 2021 10:55:02 +0100 Subject: [PATCH 6/6] Apply suggestions from code review --- packages/jest-config/package.json | 2 +- packages/jest-config/src/resolveConfigPath.ts | 6 +----- yarn.lock | 9 +-------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index 12393ef05f4a..85b7aa04dcdf 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -43,7 +43,7 @@ "jest-validate": "^27.3.1", "micromatch": "^4.0.4", "pretty-format": "^27.3.1", - "slash": "^4.0.0" + "slash": "^3.0.0" }, "devDependencies": { "@types/babel__core": "^7.0.4", diff --git a/packages/jest-config/src/resolveConfigPath.ts b/packages/jest-config/src/resolveConfigPath.ts index 61d99bf1aa8f..0f1439197a36 100644 --- a/packages/jest-config/src/resolveConfigPath.ts +++ b/packages/jest-config/src/resolveConfigPath.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import chalk = require('chalk'); import * as fs from 'graceful-fs'; -import slashModule = require('slash'); +import slash = require('slash'); import type {Config} from '@jest/types'; import { JEST_CONFIG_BASE_NAME, @@ -21,10 +21,6 @@ const isFile = (filePath: Config.Path) => const getConfigFilename = (ext: string) => JEST_CONFIG_BASE_NAME + ext; -// Fix incorrect TypeScript definition for `slash` package. -const slash: typeof slashModule.default = - slashModule as unknown as typeof slashModule.default; - export default ( pathToResolve: Config.Path, cwd: Config.Path, diff --git a/yarn.lock b/yarn.lock index 550e6aaf9bee..0b9ba8e39953 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12658,7 +12658,7 @@ fsevents@^1.2.7: micromatch: ^4.0.4 pretty-format: ^27.3.1 semver: ^7.3.5 - slash: ^4.0.0 + slash: ^3.0.0 strip-ansi: ^6.0.0 ts-node: ^9.0.0 typescript: ^4.0.3 @@ -19642,13 +19642,6 @@ react-native@0.64.0: languageName: node linkType: hard -"slash@npm:^4.0.0": - version: 4.0.0 - resolution: "slash@npm:4.0.0" - checksum: 714b10473dd5efce5ebaad47c74d69201baf7715fa58e8049d3d2716d9da25a9571bfd3ecc50c3b7f4165948e2d8d5a1aa7faeaeca4891ee71a2fbd408268091 - languageName: node - linkType: hard - "slice-ansi@npm:^2.0.0": version: 2.1.0 resolution: "slice-ansi@npm:2.1.0"