Skip to content

Commit

Permalink
fix: export globals as values, not types (#9925)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Apr 29, 2020
1 parent c5f2fd7 commit e21468d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Fixes

- `[jest-globals]` Export globals as values, not types ([#9925](https://github.com/facebook/jest/pull/9925))

### Chore & Maintenance

### Performance
Expand Down
28 changes: 14 additions & 14 deletions packages/jest-globals/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import importedExpect = require('expect');
import type {Jest} from '@jest/environment';
import type {Global} from '@jest/types';

export declare type jest = Jest;
export declare const jest: Jest;

export declare type expect = typeof importedExpect;
export declare const expect: typeof importedExpect;

export declare type it = Global.GlobalAdditions['it'];
export declare type test = Global.GlobalAdditions['test'];
export declare type fit = Global.GlobalAdditions['fit'];
export declare type xit = Global.GlobalAdditions['xit'];
export declare type xtest = Global.GlobalAdditions['xtest'];
export declare type describe = Global.GlobalAdditions['describe'];
export declare type xdescribe = Global.GlobalAdditions['xdescribe'];
export declare type fdescribe = Global.GlobalAdditions['fdescribe'];
export declare type beforeAll = Global.GlobalAdditions['beforeAll'];
export declare type beforeEach = Global.GlobalAdditions['beforeEach'];
export declare type afterEach = Global.GlobalAdditions['afterEach'];
export declare type afterAll = Global.GlobalAdditions['afterAll'];
export declare const it: Global.GlobalAdditions['it'];
export declare const test: Global.GlobalAdditions['test'];
export declare const fit: Global.GlobalAdditions['fit'];
export declare const xit: Global.GlobalAdditions['xit'];
export declare const xtest: Global.GlobalAdditions['xtest'];
export declare const describe: Global.GlobalAdditions['describe'];
export declare const xdescribe: Global.GlobalAdditions['xdescribe'];
export declare const fdescribe: Global.GlobalAdditions['fdescribe'];
export declare const beforeAll: Global.GlobalAdditions['beforeAll'];
export declare const beforeEach: Global.GlobalAdditions['beforeEach'];
export declare const afterEach: Global.GlobalAdditions['afterEach'];
export declare const afterAll: Global.GlobalAdditions['afterAll'];

throw new Error(
'Do not import `@jest/globals` outside of the Jest test environment',
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import Snapshot = require('jest-snapshot');
import stripBOM = require('strip-bom');

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

type HasteMapOptions = {
Expand Down

0 comments on commit e21468d

Please sign in to comment.