Skip to content

Commit

Permalink
fix(jest-runtime): avoid star type import from @jest/globals (#12949)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas committed Jun 20, 2022
1 parent 920b0e3 commit 7f2731e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,8 @@

### Fixes

-`[jest-runtime]` Avoid star type import from `@jest/globals` ([#12949](https://github.com/facebook/jest/pull/12949))

### Chore & Maintenance

- `[docs]` Mention that jest-codemods now supports Sinon ([#12898](https://github.com/facebook/jest/pull/12898))
Expand Down
8 changes: 4 additions & 4 deletions packages/jest-runtime/src/index.ts
Expand Up @@ -32,7 +32,7 @@ import type {
ModuleWrapper,
} from '@jest/environment';
import type {LegacyFakeTimers, ModernFakeTimers} from '@jest/fake-timers';
import type * as JestGlobals from '@jest/globals';
import type {expect, jest} from '@jest/globals';
import type {SourceMapRegistry} from '@jest/source-map';
import type {
RuntimeTransformResult,
Expand Down Expand Up @@ -69,11 +69,11 @@ const dataURIRegex =
/^data:(?<mime>text\/javascript|application\/json|application\/wasm)(?:;(?<encoding>charset=utf-8|base64))?,(?<code>.*)$/;

interface JestGlobals extends Global.TestFrameworkGlobals {
expect: typeof JestGlobals.expect;
expect: typeof expect;
}

interface JestGlobalsWithJest extends JestGlobals {
jest: typeof JestGlobals.jest;
jest: typeof jest;
}

type HasteMapOptions = {
Expand Down Expand Up @@ -2331,7 +2331,7 @@ export default class Runtime {
beforeAll: this._environment.global.beforeAll,
beforeEach: this._environment.global.beforeEach,
describe: this._environment.global.describe,
expect: this._environment.global.expect as any,
expect: this._environment.global.expect as typeof expect,
fdescribe: this._environment.global.fdescribe,
fit: this._environment.global.fit,
it: this._environment.global.it,
Expand Down

0 comments on commit 7f2731e

Please sign in to comment.