diff --git a/CHANGELOG.md b/CHANGELOG.md index 7380b3635467..c564a0f65481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Chore & Maintenance - `[@jest-reporters]` Move helper functions from `utils.ts` into separate files ([#12782](https://github.com/facebook/jest/pull/12782)) +- `[jest-resolve]` Replace `process.versions.pnp` type declaration with `@types/pnpapi` devDependency ([#12783](https://github.com/facebook/jest/pull/12783)) ### Performance diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index c55e0b04a43a..8bfe2709c673 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -30,6 +30,7 @@ "devDependencies": { "@tsd/typescript": "~4.6.2", "@types/graceful-fs": "^4.1.3", + "@types/pnpapi": "^0.0.2", "@types/resolve": "^1.20.2", "tsd-lite": "^0.5.1" }, diff --git a/packages/jest-resolve/src/defaultResolver.ts b/packages/jest-resolve/src/defaultResolver.ts index 5f121278a95b..c785c055f998 100644 --- a/packages/jest-resolve/src/defaultResolver.ts +++ b/packages/jest-resolve/src/defaultResolver.ts @@ -93,15 +93,6 @@ export type AsyncResolver = ( export type Resolver = SyncResolver | AsyncResolver; -// https://github.com/facebook/jest/pull/10617 -declare global { - namespace NodeJS { - export interface ProcessVersions { - pnp?: any; - } - } -} - const defaultResolver: SyncResolver = (path, options) => { // Yarn 2 adds support to `resolve` automatically so the pnpResolver is only // needed for Yarn 1 which implements version 1 of the pnp spec diff --git a/packages/jest-util/src/preRunMessage.ts b/packages/jest-util/src/preRunMessage.ts index cb011452c271..dd0204667457 100644 --- a/packages/jest-util/src/preRunMessage.ts +++ b/packages/jest-util/src/preRunMessage.ts @@ -9,14 +9,14 @@ import chalk = require('chalk'); import clearLine from './clearLine'; import isInteractive from './isInteractive'; -export const print = (stream: NodeJS.WriteStream): void => { +export function print(stream: NodeJS.WriteStream): void { if (isInteractive) { stream.write(chalk.bold.dim('Determining test suites to run...')); } -}; +} -export const remove = (stream: NodeJS.WriteStream): void => { +export function remove(stream: NodeJS.WriteStream): void { if (isInteractive) { clearLine(stream); } -}; +} diff --git a/packages/jest-watcher/src/lib/patternModeHelpers.ts b/packages/jest-watcher/src/lib/patternModeHelpers.ts index 0a9f31aeff53..edb6575daf05 100644 --- a/packages/jest-watcher/src/lib/patternModeHelpers.ts +++ b/packages/jest-watcher/src/lib/patternModeHelpers.ts @@ -9,26 +9,26 @@ import ansiEscapes = require('ansi-escapes'); import chalk = require('chalk'); import stringLength = require('string-length'); -export const printPatternCaret = ( +export function printPatternCaret( pattern: string, pipe: NodeJS.WritableStream, -): void => { +): void { const inputText = `${chalk.dim(' pattern \u203A')} ${pattern}`; pipe.write(ansiEscapes.eraseDown); pipe.write(inputText); pipe.write(ansiEscapes.cursorSavePosition); -}; +} -export const printRestoredPatternCaret = ( +export function printRestoredPatternCaret( pattern: string, currentUsageRows: number, pipe: NodeJS.WritableStream, -): void => { +): void { const inputText = `${chalk.dim(' pattern \u203A')} ${pattern}`; pipe.write( ansiEscapes.cursorTo(stringLength(inputText), currentUsageRows - 1), ); pipe.write(ansiEscapes.cursorRestorePosition); -}; +} diff --git a/yarn.lock b/yarn.lock index 5b8d2d5bfabf..00f2a851e3ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5221,6 +5221,13 @@ __metadata: languageName: node linkType: hard +"@types/pnpapi@npm:^0.0.2": + version: 0.0.2 + resolution: "@types/pnpapi@npm:0.0.2" + checksum: b58ec37cfaebe99ca7d1fa3200c57d8f8d51da58f6152c1b8ef6d03e00fa8595a937ae36234a0ff6f52306740bf4ddfd2633d62d5693eb9af41edb6181ef3d02 + languageName: node + linkType: hard + "@types/prettier@npm:*, @types/prettier@npm:^2.1.5": version: 2.4.4 resolution: "@types/prettier@npm:2.4.4" @@ -13392,6 +13399,7 @@ __metadata: dependencies: "@tsd/typescript": ~4.6.2 "@types/graceful-fs": ^4.1.3 + "@types/pnpapi": ^0.0.2 "@types/resolve": ^1.20.2 chalk: ^4.0.0 graceful-fs: ^4.2.9