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
TypeError: Cannot read property 'run' of undefined
The actual default export of jest no longer has anything on it. Users now have to import the exact named exports. To work around the issue, you must now do this:
import * as jest from "jest";
console.log(jest);
console.log(jest.getVersion());
// or
import {getVersion} from "jest";
console.log(getVersion());
NOTE: This is specific you using ES6 import
Last working version
Worked up to version: 24.0.0 & 24.1.0
Stopped working in version: 24.3.0
To Reproduce
See included repo link below:
import jest from "jest";
console.log(jest);
console.log(jest.getVersion());
Expected behavior
Expected jest to be defined, but it's undefined.
Expected jest to look like this:
Thanks for the report! I've opened up #8081 which fixes it.
However, I recommend you to do import {run} from 'jest' - it doesn't really have a default export. Also see #5048 for discussions about a programmatic API
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.
💥 Regression Report
The switch to use Typescript introduced a regression in a minor version change.
9fa3268#diff-153503da41d156755e19c0aedcd2eb43R10
The change is now throwing an error:
The actual default export of jest no longer has anything on it. Users now have to import the exact named exports. To work around the issue, you must now do this:
NOTE: This is specific you using ES6
import
Last working version
Worked up to version: 24.0.0 & 24.1.0
Stopped working in version: 24.3.0
To Reproduce
See included repo link below:
Expected behavior
Expected
jest
to be defined, but it's undefined.Expected jest to look like this:
Link to repl or repo (highly encouraged)
https://github.com/blackdynamo/jest-24.3.0-import-regression
24.1.0 Working
24.3.0 Not Working
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: