-
Notifications
You must be signed in to change notification settings - Fork 250
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
"Cannot read property 'runCLI' of undefined" with Jest 25.1.0 #1983
Comments
I think it is related to #1979 |
Hello,
this seems to me for the reason. IMHO Jest have changed the exports slightly, see jestjs/jest#8874 I tried to fix this in TS, but i'm not into TS. In the compiled JS this fix worked for me: update [email protected] for package file: line 5: - const jest_1 = tslib_1.__importDefault(require("jest"));
+ const jest_1 = tslib_1.__importStar(require("jest")) line 17: - return jest_1.default.runCLI(Object.assign(Object.assign({}, (fileNameUnderTest && { _: [fileNameUnderTest], findRelatedTests: true })), { config, runInBand: true, silent: true }), [projectRoot]);
+ return jest_1.runCLI(Object.assign(Object.assign({}, (fileNameUnderTest && { _: [fileNameUnderTest], findRelatedTests: true })), { config, runInBand: true, silent: true }), [projectRoot]); Maybe this helps to resolve this issue Thanks for developing stryker :) |
@nicojs it's a high time to update @types/jest... We are getting errors which are not caught by TS itself and should be ._. |
Not sure what level's causing it, but we're seeing the wrong exit code (https://github.com/libero/article-store/pull/167/checks?check_run_id=407401318#step:5:17 is passing when it shouldn't). |
Thanks for opening this detailed issue! ♥ I'll see if I can add Jest 25 compatibility this weekend. |
@simondel I guess we should make check while importing from JEST.
|
@kmdrGroch seems right: from [email protected], Object.defineProperty(exports, 'runCLI', {
enumerable: true,
get: function() {
return _core().runCLI;
}
}); therefore you can do simple (in JS): - const jest_1 = tslib_1.__importDefault(require("jest"));
+ const { runCLI } = require("jest"); and then - return jest_1.default.runCLI(Object.assign(Object.assign({}, (fileNameUnderTest && { _: [fileNameUnderTest], findRelatedTests: true })), { config, runInBand: true, silent: true }), [projectRoot]);
+ return runCLI(Object.assign(Object.assign({}, (fileNameUnderTest && { _: [fileNameUnderTest], findRelatedTests: true })), { config, runInBand: true, silent: true }), [projectRoot]); Sorry, again only plain JS, shame on me... |
Thanks @spacecowboy23! Confirmed that patch works. Here's an example of it applied using patch-package: |
@danielnixon where's the patch at? |
Thanks for all the comments in this thread. We've merged a fix to master. We will be releasing it in v3 of Stryker, hopefully next week. 🤞 |
Looking forward for this 😄 |
Hi! Jest 25 support has been released with @stryker-mutator version 3! You can read all about it here: https://stryker-mutator.io/blog/2020-03-11/stryker-version-3 |
FYI, I can confirm it works! |
Running the latest (2.5.0) of Stryker with Jest 25.1.0 results in:
This is consistent on Node 8 through 12, and doesn't happen with Jest 24.9.0.
According to Jest's changelog, 25.1.0 has changed some exports, but I couldn't find anything obvious that causes this breakage.
Here is the full debug log (with a couple of file paths omitted):
The text was updated successfully, but these errors were encountered: