You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect that importing @jest/globals would indeed add common things like describe, it, test, beforeEach, etc. to the global scope, so I don't have to import them every time explicitly:
import{describe,it,expect}from'@jest/globals';
Actual behavior
I'm seeing TSC errors like these on an attempt to compile my test suites:
globals.test.ts(1,1): error TS2593: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig.
globals.test.ts(2,3): error TS2304: Cannot find name 'beforeEach'.
globals.test.ts(6,3): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig.
Global types are not defined by any modules in this repo, they are in DT. (I realize the name of the module in Jest is bad).
@ahnpnl seems somewhat reasonable way of opting into global types. We don't have global types in this repo tho. Might make sense to add in the same way, but that's separate from this issue. Could you open up a feature request for it instead?
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
28.1.0
Steps to reproduce
Expected behavior
I expect that importing
@jest/globals
would indeed add common things likedescribe
,it
,test
,beforeEach
, etc. to the global scope, so I don't have to import them every time explicitly:Actual behavior
I'm seeing TSC errors like these on an attempt to compile my test suites:
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: