From c73da2c15dfdebf005f120ee6ce629764c5f30d7 Mon Sep 17 00:00:00 2001 From: James Diefenderfer Date: Thu, 26 Mar 2020 17:31:09 -0700 Subject: [PATCH 1/3] move jest-runtime to jest-circus dependencies Fixes #9600. --- packages/jest-circus/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index c5c5626c56a5..7e4e6e62fbaa 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -28,6 +28,7 @@ "jest-each": "^25.2.3", "jest-matcher-utils": "^25.2.3", "jest-message-util": "^25.2.3", + "jest-runtime": "^25.2.3", "jest-snapshot": "^25.2.3", "jest-util": "^25.2.3", "pretty-format": "^25.2.3", @@ -41,8 +42,7 @@ "@types/babel__traverse": "^7.0.4", "@types/co": "^4.6.0", "@types/stack-utils": "^1.0.1", - "execa": "^3.2.0", - "jest-runtime": "^25.2.3" + "execa": "^3.2.0" }, "engines": { "node": ">= 8.3" From fbcbce26a15c9dbc65a48ec95ea40ddf1432ab9e Mon Sep 17 00:00:00 2001 From: James Diefenderfer Date: Fri, 27 Mar 2020 09:48:09 -0700 Subject: [PATCH 2/3] fix type ellision of jest-runtime imports --- .../jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts | 2 +- packages/jest-jasmine2/src/index.ts | 2 +- packages/jest-runtime/src/index.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts index 34d214f38dbd..2a9561d3a8ad 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import type {Config} from '@jest/types'; import type {JestEnvironment} from '@jest/environment'; import type {TestResult} from '@jest/test-result'; -import Runtime = require('jest-runtime'); +import type {RuntimeType as Runtime} from 'jest-runtime'; import type {SnapshotStateType} from 'jest-snapshot'; const FRAMEWORK_INITIALIZER = require.resolve('./jestAdapterInit'); diff --git a/packages/jest-jasmine2/src/index.ts b/packages/jest-jasmine2/src/index.ts index d87e3451feee..f8ab81713895 100644 --- a/packages/jest-jasmine2/src/index.ts +++ b/packages/jest-jasmine2/src/index.ts @@ -10,7 +10,7 @@ import type {Config, Global} from '@jest/types'; import type {AssertionResult, TestResult} from '@jest/test-result'; import type {JestEnvironment} from '@jest/environment'; import type {SnapshotStateType} from 'jest-snapshot'; -import Runtime = require('jest-runtime'); +import type {RuntimeType as Runtime} from 'jest-runtime'; import {getCallsite} from '@jest/source-map'; import installEach from './each'; diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index 11bb29aa2850..cfef2ebf1704 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -64,6 +64,8 @@ type CacheFS = {[path: string]: string}; namespace Runtime { export type Context = JestContext; + // ditch this export when moving to esm - for now we need it for to avoid faulty type elision + export type RuntimeType = Runtime; } const testTimeoutSymbol = Symbol.for('TEST_TIMEOUT_SYMBOL'); From d2b6943d76355a465bcbcdf5d66b088bf3cdadf8 Mon Sep 17 00:00:00 2001 From: James Diefenderfer Date: Fri, 27 Mar 2020 09:48:14 -0700 Subject: [PATCH 3/3] add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb8326282019..d84b3bce67c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Fixes +- `[jest-circus]` Fix type ellision of jest-runtime imports ([#9717](https://github.com/facebook/jest/pull/9717)) + ### Chore & Maintenance ### Performance