From db055c2f413b1301d69c5a8924ba811bdd7c0e53 Mon Sep 17 00:00:00 2001 From: James Diefenderfer Date: Fri, 27 Mar 2020 12:06:52 -0700 Subject: [PATCH] Fix type ellision of jest-runtime imports (#9717) --- CHANGELOG.md | 2 ++ packages/jest-circus/package.json | 4 ++-- .../jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts | 2 +- packages/jest-jasmine2/src/index.ts | 2 +- packages/jest-runtime/src/index.ts | 2 ++ 5 files changed, 8 insertions(+), 4 deletions(-) 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 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" 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');