From 33747908c2163e51e1ab2167c0c669f2e664e3d6 Mon Sep 17 00:00:00 2001 From: cin Date: Tue, 19 Sep 2023 15:55:14 +0800 Subject: [PATCH] chore: upgrade node version (#14460) Co-authored-by: Simen Bekkhus --- .circleci/config.yml | 2 +- .github/workflows/test.yml | 2 +- CHANGELOG.md | 2 ++ constraints.pro | 2 +- package.json | 6 ++--- packages/babel-jest/package.json | 2 +- .../src/__tests__/getCacheKey.test.ts | 2 ++ packages/babel-plugin-jest-hoist/package.json | 2 +- packages/babel-preset-jest/package.json | 2 +- packages/create-jest/package.json | 2 +- packages/diff-sequences/package.json | 2 +- packages/expect-utils/package.json | 2 +- packages/expect/package.json | 2 +- packages/jest-changed-files/package.json | 2 +- packages/jest-circus/package.json | 2 +- packages/jest-circus/src/eventHandler.ts | 11 +++++--- .../jest-circus/src/globalErrorHandlers.ts | 5 ++-- .../jestAdapterInit.ts | 3 ++- packages/jest-circus/src/run.ts | 7 +++--- packages/jest-circus/src/state.ts | 9 ++++--- packages/jest-circus/src/types.ts | 14 ----------- packages/jest-cli/package.json | 2 +- packages/jest-config/package.json | 2 +- packages/jest-console/package.json | 2 +- packages/jest-core/package.json | 2 +- packages/jest-core/src/runJest.ts | 1 - .../package.json | 2 +- packages/jest-diff/package.json | 2 +- packages/jest-docblock/package.json | 2 +- packages/jest-each/package.json | 2 +- packages/jest-environment-jsdom/package.json | 2 +- packages/jest-environment-jsdom/src/index.ts | 2 +- packages/jest-environment-node/package.json | 2 +- packages/jest-environment-node/src/index.ts | 1 - packages/jest-environment/package.json | 2 +- packages/jest-expect/package.json | 2 +- packages/jest-fake-timers/package.json | 2 +- packages/jest-get-type/package.json | 2 +- packages/jest-globals/package.json | 2 +- packages/jest-haste-map/package.json | 2 +- packages/jest-jasmine2/package.json | 2 +- .../jest-jasmine2/src/jasmine/jasmineLight.ts | 11 +++++--- packages/jest-jasmine2/src/jestExpect.ts | 5 ++-- packages/jest-jasmine2/src/types.ts | 3 ++- packages/jest-leak-detector/package.json | 2 +- packages/jest-leak-detector/src/index.ts | 1 - packages/jest-matcher-utils/package.json | 2 +- packages/jest-message-util/package.json | 2 +- packages/jest-mock/package.json | 2 +- packages/jest-phabricator/package.json | 2 +- packages/jest-regex-util/package.json | 2 +- packages/jest-repl/package.json | 2 +- packages/jest-reporters/package.json | 2 +- .../jest-resolve-dependencies/package.json | 2 +- packages/jest-resolve/package.json | 2 +- packages/jest-resolve/src/fileWalkers.ts | 1 - packages/jest-runner/package.json | 2 +- packages/jest-runner/src/runTest.ts | 1 - packages/jest-runtime/package.json | 2 +- .../__tests__/runtime_require_module.test.js | 2 ++ packages/jest-runtime/src/index.ts | 25 +++---------------- packages/jest-schemas/package.json | 2 +- packages/jest-snapshot/package.json | 2 +- packages/jest-source-map/package.json | 2 +- packages/jest-test-result/package.json | 2 +- packages/jest-test-sequencer/package.json | 2 +- packages/jest-transform/package.json | 2 +- packages/jest-types/package.json | 2 +- packages/jest-types/src/Circus.ts | 9 +++---- packages/jest-util/package.json | 2 +- packages/jest-util/src/createProcessObject.ts | 3 ++- packages/jest-validate/package.json | 2 +- packages/jest-watcher/package.json | 2 +- packages/jest-worker/package.json | 2 +- .../src/workers/ChildProcessWorker.ts | 2 +- packages/jest/package.json | 2 +- packages/pretty-format/package.json | 2 +- packages/test-globals/package.json | 2 +- packages/test-utils/package.json | 2 +- yarn.lock | 10 ++++---- 80 files changed, 116 insertions(+), 132 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fe35a4fc5a7f..7280fa057c1d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,5 +59,5 @@ workflows: matrix: parameters: # For some reason, v20 fails to run yarn install… - node-version: ['14', '16', '18', '19'] + node-version: ['16', '18'] - test-jest-jasmine diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc7c7a2458ae..91f24574562b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [14.x, 16.x, 18.x, 19.x, 20.x] + node-version: [16.x, 18.x, 20.x] shard: ['1/4', '2/4', '3/4', '4/4'] name: Node v${{ matrix.node-version }} on ${{ inputs.os }} (${{ matrix.shard }}) runs-on: ${{ inputs.os }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 523ff385cd0a..736de82e8132 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ ### Chore & Maintenance +- `[*]` [**BREAKING**] Drop support for Node.js versions 14 and 19 ([#14460](https://github.com/jestjs/jest/pull/14460)) + ## 29.7.0 ### Features diff --git a/constraints.pro b/constraints.pro index 88abcbdd71f8..eb59863a1c6c 100644 --- a/constraints.pro +++ b/constraints.pro @@ -57,7 +57,7 @@ gen_enforced_field(WorkspaceCwd, 'publishConfig.access', null) :- workspace_field(WorkspaceCwd, 'private', true). % Enforces the engines.node field for public workspace -gen_enforced_field(WorkspaceCwd, 'engines.node', '^14.15.0 || ^16.10.0 || >=18.0.0') :- +gen_enforced_field(WorkspaceCwd, 'engines.node', '^16.10.0 || ^18.12.0 || >=20.0.0') :- \+ workspace_field(WorkspaceCwd, 'private', true). % Enforces the main and types field to start with ./ diff --git a/package.json b/package.json index 9ed8d76b57cf..ac6b3fce29c6 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@types/babel__core": "^7.1.14", "@types/babel__generator": "^7.0.0", "@types/babel__template": "^7.0.2", - "@types/node": "~14.14.45", + "@types/node": "^16.10.0", "@types/which": "^3.0.0", "@types/ws": "8.5.1", "@typescript-eslint/eslint-plugin": "^5.14.0", @@ -170,10 +170,10 @@ "logo": "https://opencollective.com/jest/logo.txt" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "resolutions": { - "@types/node": "~14.14.45", + "@types/node": "~16.18.0", "@types/react": "^18.2.21", "ansi-escapes/type-fest": "^2.0.0", "babel-jest": "workspace:^", diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index 8a52ffc627ca..b783f4f16809 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -35,7 +35,7 @@ "@babel/core": "^7.8.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/babel-jest/src/__tests__/getCacheKey.test.ts b/packages/babel-jest/src/__tests__/getCacheKey.test.ts index fbe3a0b34b0c..eb9b2da1107b 100644 --- a/packages/babel-jest/src/__tests__/getCacheKey.test.ts +++ b/packages/babel-jest/src/__tests__/getCacheKey.test.ts @@ -20,6 +20,7 @@ afterEach(() => { jest.resetModules(); if (process.version === 'new-node-version') { + // @ts-expect-error: Testing purpose process.version = processVersion; } @@ -194,6 +195,7 @@ describe('getCacheKey', () => { test('if node version is changing', () => { // @ts-expect-error: Testing purpose delete process.version; + // @ts-expect-error: Testing purpose process.version = 'new-node-version'; const newCacheKey = getCacheKey!(sourceText, sourcePath, transformOptions); diff --git a/packages/babel-plugin-jest-hoist/package.json b/packages/babel-plugin-jest-hoist/package.json index 486107b0be41..9708b66d2490 100644 --- a/packages/babel-plugin-jest-hoist/package.json +++ b/packages/babel-plugin-jest-hoist/package.json @@ -7,7 +7,7 @@ "directory": "packages/babel-plugin-jest-hoist" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/babel-preset-jest/package.json b/packages/babel-preset-jest/package.json index e2e05eaf9129..0fda8bd9bf32 100644 --- a/packages/babel-preset-jest/package.json +++ b/packages/babel-preset-jest/package.json @@ -20,7 +20,7 @@ "@babel/core": "^7.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/create-jest/package.json b/packages/create-jest/package.json index f0a1d456b9d8..627bad9a629a 100644 --- a/packages/create-jest/package.json +++ b/packages/create-jest/package.json @@ -29,7 +29,7 @@ "prompts": "^2.0.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/diff-sequences/package.json b/packages/diff-sequences/package.json index 9f5ac6018011..ad26c505acfe 100644 --- a/packages/diff-sequences/package.json +++ b/packages/diff-sequences/package.json @@ -16,7 +16,7 @@ "diff" ], "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "main": "./build/index.js", "types": "./build/index.d.ts", diff --git a/packages/expect-utils/package.json b/packages/expect-utils/package.json index dc6404127b89..d5197659c9db 100644 --- a/packages/expect-utils/package.json +++ b/packages/expect-utils/package.json @@ -26,7 +26,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/expect/package.json b/packages/expect/package.json index 3ea031a6a517..96fb564168c7 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -34,7 +34,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-changed-files/package.json b/packages/jest-changed-files/package.json index 7f1256a2d71e..18981b9a9837 100644 --- a/packages/jest-changed-files/package.json +++ b/packages/jest-changed-files/package.json @@ -22,7 +22,7 @@ "p-limit": "^3.1.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index 364586ac8c74..738eb54e7f9c 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -50,7 +50,7 @@ "tempy": "^1.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-circus/src/eventHandler.ts b/packages/jest-circus/src/eventHandler.ts index 4c401cada760..8a7e2403e52b 100644 --- a/packages/jest-circus/src/eventHandler.ts +++ b/packages/jest-circus/src/eventHandler.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import type {Circus} from '@jest/types'; +import type {Circus, Global} from '@jest/types'; import {invariant} from 'jest-util'; import { injectGlobalErrorHandlers, @@ -217,7 +217,7 @@ const eventHandler: Circus.EventHandler = (event, state) => { case 'test_retry': { const logErrorsBeforeRetry: boolean = // eslint-disable-next-line no-restricted-globals - global[LOG_ERRORS_BEFORE_RETRY] || false; + ((global as Global.Global)[LOG_ERRORS_BEFORE_RETRY] as any) || false; if (logErrorsBeforeRetry) { event.test.retryReasons.push(...event.test.errors); } @@ -227,8 +227,11 @@ const eventHandler: Circus.EventHandler = (event, state) => { case 'run_start': { state.hasStarted = true; /* eslint-disable no-restricted-globals */ - global[TEST_TIMEOUT_SYMBOL] && - (state.testTimeout = global[TEST_TIMEOUT_SYMBOL]); + if ((global as Global.Global)[TEST_TIMEOUT_SYMBOL]) { + state.testTimeout = (global as Global.Global)[ + TEST_TIMEOUT_SYMBOL + ] as number; + } /* eslint-enable */ break; } diff --git a/packages/jest-circus/src/globalErrorHandlers.ts b/packages/jest-circus/src/globalErrorHandlers.ts index 27146fc4a1f2..317ae3d41d52 100644 --- a/packages/jest-circus/src/globalErrorHandlers.ts +++ b/packages/jest-circus/src/globalErrorHandlers.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type * as Process from 'process'; import type {Circus} from '@jest/types'; import {dispatchSync} from './state'; @@ -14,7 +15,7 @@ const uncaught: NodeJS.UncaughtExceptionListener & }; export const injectGlobalErrorHandlers = ( - parentProcess: NodeJS.Process, + parentProcess: typeof Process, ): Circus.GlobalErrorHandlers => { const uncaughtException = process.listeners('uncaughtException').slice(); const unhandledRejection = process.listeners('unhandledRejection').slice(); @@ -26,7 +27,7 @@ export const injectGlobalErrorHandlers = ( }; export const restoreGlobalErrorHandlers = ( - parentProcess: NodeJS.Process, + parentProcess: typeof Process, originalErrorHandlers: Circus.GlobalErrorHandlers, ): void => { parentProcess.removeListener('uncaughtException', uncaught); diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts index 8b29cb7d1082..01c121317d97 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type * as Process from 'process'; import type {JestEnvironment} from '@jest/environment'; import {JestExpect, jestExpect} from '@jest/expect'; import { @@ -51,7 +52,7 @@ export const initialize = async ({ globalConfig: Config.GlobalConfig; localRequire: (path: string) => T; testPath: string; - parentProcess: NodeJS.Process; + parentProcess: typeof Process; sendMessageToJest?: TestFileEvent; setGlobalsForRuntime: (globals: RuntimeGlobals) => void; }): Promise<{ diff --git a/packages/jest-circus/src/run.ts b/packages/jest-circus/src/run.ts index 0aaf6d612b72..c2cd6063cd1e 100644 --- a/packages/jest-circus/src/run.ts +++ b/packages/jest-circus/src/run.ts @@ -8,7 +8,7 @@ import {AsyncLocalStorage} from 'async_hooks'; import pLimit = require('p-limit'); import {jestExpect} from '@jest/expect'; -import type {Circus} from '@jest/types'; +import type {Circus, Global} from '@jest/types'; import {invariant} from 'jest-util'; import shuffleArray, {RandomNumberGenerator, rngBuilder} from './shuffleArray'; import {dispatch, getState} from './state'; @@ -61,8 +61,9 @@ const _runTestsForDescribeBlock = async ( } // Tests that fail and are retried we run after other tests - // eslint-disable-next-line no-restricted-globals - const retryTimes = parseInt(global[RETRY_TIMES], 10) || 0; + const retryTimes = + // eslint-disable-next-line no-restricted-globals + parseInt((global as Global.Global)[RETRY_TIMES] as string, 10) || 0; const deferredRetryTests = []; if (rng) { diff --git a/packages/jest-circus/src/state.ts b/packages/jest-circus/src/state.ts index 0540dfd41116..ecd94cbf14c1 100644 --- a/packages/jest-circus/src/state.ts +++ b/packages/jest-circus/src/state.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import type {Circus} from '@jest/types'; +import type {Circus, Global} from '@jest/types'; import eventHandler from './eventHandler'; import formatNodeAssertErrors from './formatNodeAssertErrors'; import {STATE_SYM} from './types'; @@ -39,14 +39,15 @@ const createState = (): Circus.State => { /* eslint-disable no-restricted-globals */ export const resetState = (): void => { - global[STATE_SYM] = createState(); + (global as Global.Global)[STATE_SYM] = createState(); }; resetState(); -export const getState = (): Circus.State => global[STATE_SYM]; +export const getState = (): Circus.State => + (global as Global.Global)[STATE_SYM] as Circus.State; export const setState = (state: Circus.State): Circus.State => - (global[STATE_SYM] = state); + ((global as Global.Global)[STATE_SYM] = state); /* eslint-enable */ export const dispatch = async (event: Circus.AsyncEvent): Promise => { diff --git a/packages/jest-circus/src/types.ts b/packages/jest-circus/src/types.ts index 6af26152b661..704a35b3733d 100644 --- a/packages/jest-circus/src/types.ts +++ b/packages/jest-circus/src/types.ts @@ -5,22 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Circus} from '@jest/types'; - export const STATE_SYM = Symbol('JEST_STATE_SYMBOL'); export const RETRY_TIMES = Symbol.for('RETRY_TIMES'); // To pass this value from Runtime object to state we need to use global[sym] export const TEST_TIMEOUT_SYMBOL = Symbol.for('TEST_TIMEOUT_SYMBOL'); export const LOG_ERRORS_BEFORE_RETRY = Symbol.for('LOG_ERRORS_BEFORE_RETRY'); - -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace NodeJS { - interface Global { - [STATE_SYM]: Circus.State; - [RETRY_TIMES]: string; - [TEST_TIMEOUT_SYMBOL]: number; - [LOG_ERRORS_BEFORE_RETRY]: boolean; - } - } -} diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index df717234c08f..b29d6cb5fa8a 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -43,7 +43,7 @@ "jest": "./bin/jest.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "repository": { "type": "git", diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index e9b914245428..d0903e0e6a0b 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -62,7 +62,7 @@ "typescript": "^5.0.4" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 0393e203b536..27b8f139ad63 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -28,7 +28,7 @@ "@jest/test-utils": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 4544fbce2175..6f2e036df8a3 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -57,7 +57,7 @@ } }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "repository": { "type": "git", diff --git a/packages/jest-core/src/runJest.ts b/packages/jest-core/src/runJest.ts index ce8e332163c3..f6d533251fc0 100644 --- a/packages/jest-core/src/runJest.ts +++ b/packages/jest-core/src/runJest.ts @@ -294,7 +294,6 @@ export default async function runJest({ ...testSchedulerContext, }); - // @ts-expect-error - second arg is unsupported (but harmless) in Node 14 performance.mark('jest/scheduleAndRun:start', { detail: {numTests: allTests.length}, }); diff --git a/packages/jest-create-cache-key-function/package.json b/packages/jest-create-cache-key-function/package.json index ff03ba21cd99..ebb08c2fb08f 100644 --- a/packages/jest-create-cache-key-function/package.json +++ b/packages/jest-create-cache-key-function/package.json @@ -14,7 +14,7 @@ "jest-util": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-diff/package.json b/packages/jest-diff/package.json index ca4584498f3a..eb182798db4d 100644 --- a/packages/jest-diff/package.json +++ b/packages/jest-diff/package.json @@ -27,7 +27,7 @@ "strip-ansi": "^6.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-docblock/package.json b/packages/jest-docblock/package.json index 31b48fd0632f..0497db933410 100644 --- a/packages/jest-docblock/package.json +++ b/packages/jest-docblock/package.json @@ -23,7 +23,7 @@ "@types/node": "*" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-each/package.json b/packages/jest-each/package.json index 06a9f85ea004..751eeb2610c2 100644 --- a/packages/jest-each/package.json +++ b/packages/jest-each/package.json @@ -32,7 +32,7 @@ "pretty-format": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-environment-jsdom/package.json b/packages/jest-environment-jsdom/package.json index a987fc6058ff..033614f3d268 100644 --- a/packages/jest-environment-jsdom/package.json +++ b/packages/jest-environment-jsdom/package.json @@ -38,7 +38,7 @@ } }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-environment-jsdom/src/index.ts b/packages/jest-environment-jsdom/src/index.ts index 5fca82395957..994108dd2005 100644 --- a/packages/jest-environment-jsdom/src/index.ts +++ b/packages/jest-environment-jsdom/src/index.ts @@ -73,7 +73,7 @@ export default class JSDOMEnvironment implements JestEnvironment { throw new Error('JSDOM did not return a Window object'); } - // @ts-expect-error - for "universal" code (code should use `globalThis`) + // TODO: remove at some point - for "universal" code (code should use `globalThis`) global.global = global; // Node's error-message stack size is limited at 10, but it's pretty useful diff --git a/packages/jest-environment-node/package.json b/packages/jest-environment-node/package.json index 96ce939089fa..b2a7ee424f70 100644 --- a/packages/jest-environment-node/package.json +++ b/packages/jest-environment-node/package.json @@ -28,7 +28,7 @@ "@jest/test-utils": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-environment-node/src/index.ts b/packages/jest-environment-node/src/index.ts index 52e715f7351a..9510fdba8246 100644 --- a/packages/jest-environment-node/src/index.ts +++ b/packages/jest-environment-node/src/index.ts @@ -129,7 +129,6 @@ export default class NodeEnvironment implements JestEnvironment { } } - // @ts-expect-error - Buffer and gc is "missing" global.global = global; global.Buffer = Buffer; global.ArrayBuffer = ArrayBuffer; diff --git a/packages/jest-environment/package.json b/packages/jest-environment/package.json index 3e91305448d7..eae4c483baa4 100644 --- a/packages/jest-environment/package.json +++ b/packages/jest-environment/package.json @@ -23,7 +23,7 @@ "jest-mock": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-expect/package.json b/packages/jest-expect/package.json index c4c8f6f5dcbb..3ec6a7497efe 100644 --- a/packages/jest-expect/package.json +++ b/packages/jest-expect/package.json @@ -25,7 +25,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-fake-timers/package.json b/packages/jest-fake-timers/package.json index 4d38a871cb14..29279d9695d1 100644 --- a/packages/jest-fake-timers/package.json +++ b/packages/jest-fake-timers/package.json @@ -29,7 +29,7 @@ "@types/sinonjs__fake-timers": "^8.1.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-get-type/package.json b/packages/jest-get-type/package.json index 356782c0248c..5daa3eff7b9f 100644 --- a/packages/jest-get-type/package.json +++ b/packages/jest-get-type/package.json @@ -8,7 +8,7 @@ "directory": "packages/jest-get-type" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-globals/package.json b/packages/jest-globals/package.json index 13bbc5daedd5..097c20179b65 100644 --- a/packages/jest-globals/package.json +++ b/packages/jest-globals/package.json @@ -7,7 +7,7 @@ "directory": "packages/jest-globals" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index b645bce08752..bfe0c5e2e4ac 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -38,7 +38,7 @@ "fsevents": "^2.3.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-jasmine2/package.json b/packages/jest-jasmine2/package.json index 62e7b06cb1dd..2b9e44b7846e 100644 --- a/packages/jest-jasmine2/package.json +++ b/packages/jest-jasmine2/package.json @@ -39,7 +39,7 @@ "@types/co": "^4.6.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-jasmine2/src/jasmine/jasmineLight.ts b/packages/jest-jasmine2/src/jasmine/jasmineLight.ts index 3a1cb0b66c1e..9146bde3e1cc 100644 --- a/packages/jest-jasmine2/src/jasmine/jasmineLight.ts +++ b/packages/jest-jasmine2/src/jasmine/jasmineLight.ts @@ -30,6 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */ +import type {Global} from '@jest/types'; import type {Jasmine, SpecDefinitionsFn} from '../types'; import Env from './Env'; import JsApiReporter from './JsApiReporter'; @@ -58,12 +59,16 @@ export const create = function (createOptions: Record): Jasmine { configurable: true, enumerable: true, get() { - // eslint-disable-next-line no-restricted-globals - return global[testTimeoutSymbol] || createOptions.testTimeout || 5000; + return ( + // eslint-disable-next-line no-restricted-globals + (global as Global.Global)[testTimeoutSymbol] || + createOptions.testTimeout || + 5000 + ); }, set(value) { // eslint-disable-next-line no-restricted-globals - global[testTimeoutSymbol] = value; + (global as Global.Global)[testTimeoutSymbol] = value; }, }); diff --git a/packages/jest-jasmine2/src/jestExpect.ts b/packages/jest-jasmine2/src/jestExpect.ts index 4444ae59c834..c1d15059d161 100644 --- a/packages/jest-jasmine2/src/jestExpect.ts +++ b/packages/jest-jasmine2/src/jestExpect.ts @@ -8,15 +8,16 @@ /* eslint-disable local/prefer-spread-eventually */ import {jestExpect} from '@jest/expect'; +import type {Global} from '@jest/types'; import type {JasmineMatchersObject} from './types'; export default function jestExpectAdapter(config: {expand: boolean}): void { // eslint-disable-next-line no-restricted-globals - global.expect = jestExpect; + (global as Global.Global).expect = jestExpect; jestExpect.setState({expand: config.expand}); // eslint-disable-next-line no-restricted-globals - const jasmine = global.jasmine; + const jasmine = (global as Global.Global).jasmine; jasmine.anything = jestExpect.anything; jasmine.any = jestExpect.any; jasmine.objectContaining = jestExpect.objectContaining; diff --git a/packages/jest-jasmine2/src/types.ts b/packages/jest-jasmine2/src/types.ts index d2d74fae84f9..6ed1323b8ada 100644 --- a/packages/jest-jasmine2/src/types.ts +++ b/packages/jest-jasmine2/src/types.ts @@ -6,6 +6,7 @@ */ import type {AssertionError} from 'assert'; +import type * as Process from 'process'; import type {AsymmetricMatchers, JestExpect} from '@jest/expect'; import type CallTracker from './jasmine/CallTracker'; import type Env from './jasmine/Env'; @@ -69,7 +70,7 @@ export type Jasmine = { version: string; testPath: string; addMatchers: (matchers: JasmineMatchersObject) => void; -} & AsymmetricMatchers & {process: NodeJS.Process}; +} & AsymmetricMatchers & {process: typeof Process}; declare global { // eslint-disable-next-line @typescript-eslint/no-namespace diff --git a/packages/jest-leak-detector/package.json b/packages/jest-leak-detector/package.json index 5c95b96765c3..ab718b7282a5 100644 --- a/packages/jest-leak-detector/package.json +++ b/packages/jest-leak-detector/package.json @@ -24,7 +24,7 @@ "@types/node": "*" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-leak-detector/src/index.ts b/packages/jest-leak-detector/src/index.ts index 3de50dacac7b..bea46b4a45e9 100644 --- a/packages/jest-leak-detector/src/index.ts +++ b/packages/jest-leak-detector/src/index.ts @@ -63,7 +63,6 @@ export default class LeakDetector { } private _runGarbageCollector() { - // @ts-expect-error: not a function on `globalThis` const isGarbageCollectorHidden = globalThis.gc == null; // GC is usually hidden, so we have to expose it before running. diff --git a/packages/jest-matcher-utils/package.json b/packages/jest-matcher-utils/package.json index 5756520c26a3..9c276aeba99a 100644 --- a/packages/jest-matcher-utils/package.json +++ b/packages/jest-matcher-utils/package.json @@ -8,7 +8,7 @@ "directory": "packages/jest-matcher-utils" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index d372d571eedd..a363234e6594 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -7,7 +7,7 @@ "directory": "packages/jest-message-util" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-mock/package.json b/packages/jest-mock/package.json index d76b64721833..24c2cb7e68be 100644 --- a/packages/jest-mock/package.json +++ b/packages/jest-mock/package.json @@ -26,7 +26,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-phabricator/package.json b/packages/jest-phabricator/package.json index 08aeb664e3f8..8adfa79ebb71 100644 --- a/packages/jest-phabricator/package.json +++ b/packages/jest-phabricator/package.json @@ -18,7 +18,7 @@ "@jest/test-result": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-regex-util/package.json b/packages/jest-regex-util/package.json index 7c7efc628aed..0edb37ecb2de 100644 --- a/packages/jest-regex-util/package.json +++ b/packages/jest-regex-util/package.json @@ -10,7 +10,7 @@ "@types/node": "*" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index 5202f7bf064c..173a70e98116 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -40,7 +40,7 @@ "jest-runtime": "./bin/jest-runtime-cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index 893b486b1d68..5ebf6cfb7403 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -63,7 +63,7 @@ } }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "repository": { "type": "git", diff --git a/packages/jest-resolve-dependencies/package.json b/packages/jest-resolve-dependencies/package.json index 403e37aabe8b..11934ebc3214 100644 --- a/packages/jest-resolve-dependencies/package.json +++ b/packages/jest-resolve-dependencies/package.json @@ -28,7 +28,7 @@ "jest-runtime": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index e12d745556e3..11b49ce48523 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -35,7 +35,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-resolve/src/fileWalkers.ts b/packages/jest-resolve/src/fileWalkers.ts index 0228a8a723c3..6821310439fb 100644 --- a/packages/jest-resolve/src/fileWalkers.ts +++ b/packages/jest-resolve/src/fileWalkers.ts @@ -30,7 +30,6 @@ function statSyncCached(path: string): IPathType { let stat; try { - // @ts-expect-error TS2554 - throwIfNoEntry is only available in recent version of node, but inclusion of the option is a backward compatible no-op. stat = fs.statSync(path, {throwIfNoEntry: false}); } catch (e: any) { if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) { diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index 92319a0dc596..bd0ec7b49e1a 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -49,7 +49,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-runner/src/runTest.ts b/packages/jest-runner/src/runTest.ts index 015956be9857..ffb458157587 100644 --- a/packages/jest-runner/src/runTest.ts +++ b/packages/jest-runner/src/runTest.ts @@ -353,7 +353,6 @@ async function runTestInternal( } if (globalConfig.logHeapUsage) { - // @ts-expect-error - doesn't exist on globalThis globalThis.gc?.(); result.memoryUsage = process.memoryUsage().heapUsed; diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index a3713d5ccb17..228a14bdad8e 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -47,7 +47,7 @@ "jest-environment-node": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-runtime/src/__tests__/runtime_require_module.test.js b/packages/jest-runtime/src/__tests__/runtime_require_module.test.js index 639e4c4503f5..46bd064769e8 100644 --- a/packages/jest-runtime/src/__tests__/runtime_require_module.test.js +++ b/packages/jest-runtime/src/__tests__/runtime_require_module.test.js @@ -41,6 +41,7 @@ describe('Runtime requireModule', () => { 'exports', 'filename', 'id', + 'isPreloading', 'loaded', 'path', 'parent', @@ -60,6 +61,7 @@ describe('Runtime requireModule', () => { 'exports', 'filename', 'id', + 'isPreloading', 'loaded', 'path', 'parent', diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index c38d110c1eb9..61074414b2b5 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -942,6 +942,7 @@ export default class Runtime { exports: {}, filename: modulePath, id: modulePath, + isPreloading: false, loaded: false, path: path.dirname(modulePath), }; @@ -966,9 +967,7 @@ export default class Runtime { requireInternalModule(from: string, to?: string): T { if (to) { - const require = ( - nativeModule.createRequire ?? nativeModule.createRequireFromPath - )(from); + const require = nativeModule.createRequire(from); if (INTERNAL_MODULE_REQUIRE_OUTSIDE_OPTIMIZED_MODULES.has(to)) { return require(to); } @@ -1054,6 +1053,7 @@ export default class Runtime { exports: {}, filename: modulePath, id: modulePath, + isPreloading: false, loaded: false, path: path.dirname(modulePath), }; @@ -1803,6 +1803,7 @@ export default class Runtime { exports: {}, filename, id: filename, + isPreloading: false, loaded: false, path: path.dirname(filename), }); @@ -1821,24 +1822,6 @@ export default class Runtime { if ('createRequire' in nativeModule) { Module.createRequire = createRequire; } - if ('createRequireFromPath' in nativeModule) { - Module.createRequireFromPath = function createRequireFromPath( - filename: string | URL, - ) { - if (typeof filename !== 'string') { - const error: NodeJS.ErrnoException = new TypeError( - `The argument 'filename' must be string. Received '${filename}'.${ - filename instanceof URL - ? ' Use createRequire for URL filename.' - : '' - }`, - ); - error.code = 'ERR_INVALID_ARG_TYPE'; - throw error; - } - return createRequire(filename); - }; - } if ('syncBuiltinESMExports' in nativeModule) { // cast since TS seems very confused about whether it exists or not (Module as any).syncBuiltinESMExports = diff --git a/packages/jest-schemas/package.json b/packages/jest-schemas/package.json index 977931d88965..7ed94363463e 100644 --- a/packages/jest-schemas/package.json +++ b/packages/jest-schemas/package.json @@ -20,7 +20,7 @@ "@sinclair/typebox": "^0.27.8" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index 7dcdf317de3c..c53b6317fec1 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -54,7 +54,7 @@ "tsd-lite": "^0.7.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-source-map/package.json b/packages/jest-source-map/package.json index b7a2d05b9134..8a65f241f086 100644 --- a/packages/jest-source-map/package.json +++ b/packages/jest-source-map/package.json @@ -25,7 +25,7 @@ "@types/graceful-fs": "^4.1.3" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-test-result/package.json b/packages/jest-test-result/package.json index 1e4c68eafdec..909516fbbd5d 100644 --- a/packages/jest-test-result/package.json +++ b/packages/jest-test-result/package.json @@ -27,7 +27,7 @@ "jest-resolve": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-test-sequencer/package.json b/packages/jest-test-sequencer/package.json index c6a4018e3b20..95d7b5c02fa4 100644 --- a/packages/jest-test-sequencer/package.json +++ b/packages/jest-test-sequencer/package.json @@ -27,7 +27,7 @@ "@types/graceful-fs": "^4.1.3" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index 75a2a459fc3e..ac40d75b3942 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -43,7 +43,7 @@ "dedent": "^1.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index fa55541874b9..1ac21a8a3759 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -7,7 +7,7 @@ "directory": "packages/jest-types" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "license": "MIT", "main": "./build/index.js", diff --git a/packages/jest-types/src/Circus.ts b/packages/jest-types/src/Circus.ts index 2b27c314f541..31906d9b7f95 100644 --- a/packages/jest-types/src/Circus.ts +++ b/packages/jest-types/src/Circus.ts @@ -5,9 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import type * as ProcessModule from 'process'; import type * as Global from './Global'; -type Process = NodeJS.Process; +type Process = typeof ProcessModule; export type DoneFn = Global.DoneFn; export type BlockFn = Global.BlockFn; @@ -213,10 +214,8 @@ export type RunResult = { export type TestResults = Array; export type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array< - (exception: Exception, promise: Promise) => void - >; + uncaughtException: Array; + unhandledRejection: Array; }; export type State = { diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index f03ffcb52d74..b65d0c5391a5 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -29,7 +29,7 @@ "@types/picomatch": "^2.2.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-util/src/createProcessObject.ts b/packages/jest-util/src/createProcessObject.ts index 252b121275be..baa6916a64fe 100644 --- a/packages/jest-util/src/createProcessObject.ts +++ b/packages/jest-util/src/createProcessObject.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type * as Process from 'process'; import deepCyclicCopy from './deepCyclicCopy'; const BLACKLIST = new Set(['env', 'mainModule', '_events']); @@ -79,7 +80,7 @@ function createProcessEnv(): NodeJS.ProcessEnv { return Object.assign(proxy, process.env); } -export default function createProcessObject(): NodeJS.Process { +export default function createProcessObject(): typeof Process { const process = require('process'); const newProcess = deepCyclicCopy(process, { blacklist: BLACKLIST, diff --git a/packages/jest-validate/package.json b/packages/jest-validate/package.json index 6799e164205d..43df3220f431 100644 --- a/packages/jest-validate/package.json +++ b/packages/jest-validate/package.json @@ -28,7 +28,7 @@ "@types/yargs": "^17.0.8" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-watcher/package.json b/packages/jest-watcher/package.json index e8f15f73282f..eef1adf555e3 100644 --- a/packages/jest-watcher/package.json +++ b/packages/jest-watcher/package.json @@ -30,7 +30,7 @@ "url": "https://github.com/jestjs/jest/issues" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "homepage": "https://jestjs.io/", "license": "MIT", diff --git a/packages/jest-worker/package.json b/packages/jest-worker/package.json index f3d805750f5c..1dbe257653ea 100644 --- a/packages/jest-worker/package.json +++ b/packages/jest-worker/package.json @@ -33,7 +33,7 @@ "worker-farm": "^1.6.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-worker/src/workers/ChildProcessWorker.ts b/packages/jest-worker/src/workers/ChildProcessWorker.ts index 5292a870c581..8040ed953150 100644 --- a/packages/jest-worker/src/workers/ChildProcessWorker.ts +++ b/packages/jest-worker/src/workers/ChildProcessWorker.ts @@ -486,7 +486,7 @@ export default class ChildProcessWorker * @returns Process id. */ getWorkerSystemId(): number { - return this._child.pid; + return this._child.pid!; } getStdout(): NodeJS.ReadableStream | null { diff --git a/packages/jest/package.json b/packages/jest/package.json index bdfbcbb6ae07..21e2081c9fe7 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -32,7 +32,7 @@ }, "bin": "./bin/jest.js", "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "repository": { "type": "git", diff --git a/packages/pretty-format/package.json b/packages/pretty-format/package.json index cdcde312bc77..7c510b886789 100644 --- a/packages/pretty-format/package.json +++ b/packages/pretty-format/package.json @@ -34,7 +34,7 @@ "react-test-renderer": "17.0.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/test-globals/package.json b/packages/test-globals/package.json index abac51998540..720062e2d994 100644 --- a/packages/test-globals/package.json +++ b/packages/test-globals/package.json @@ -18,6 +18,6 @@ "jest-mock": "workspace:^" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" } } diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index b76b9b58f291..4239cd8439c1 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -24,6 +24,6 @@ "@types/semver": "^7.1.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" } } diff --git a/yarn.lock b/yarn.lock index 8e088e228b5b..03a1c01e0684 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2938,7 +2938,7 @@ __metadata: "@types/babel__core": ^7.1.14 "@types/babel__generator": ^7.0.0 "@types/babel__template": ^7.0.2 - "@types/node": ~14.14.45 + "@types/node": ^16.10.0 "@types/which": ^3.0.0 "@types/ws": 8.5.1 "@typescript-eslint/eslint-plugin": ^5.14.0 @@ -5111,10 +5111,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:~14.14.45": - version: 14.14.45 - resolution: "@types/node@npm:14.14.45" - checksum: 3870a0128011b01c6fb6655e0f682b1b660e141f84d76c70fe503f5c7cf38bd06fc7b9a7d3c760601bce0598421f552695de40f095863ede29a6e22a13213b3e +"@types/node@npm:~16.18.0": + version: 16.18.52 + resolution: "@types/node@npm:16.18.52" + checksum: 6b1f27a848a69a70039cb27c2583317b5d051990933955c42bc2a2f299266ffa360f7cc3c7089d04fdf39144c476d475931900f00dabbc4f933eeb2d664f9778 languageName: node linkType: hard