Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export globals as values, not types #9925

Merged
merged 1 commit into from Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
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
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
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