-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Mocking of fs module in Jest broken in 10.5.0 #21489
Comments
Seems in v10.5.0 In Jest |
@jasnell Sorry to ping you directly, but are there any plans for a fix here? |
Dug into why we don't include accessors, and it seems to be by design: jestjs/jest#390 I'll try to ask if it's still needed |
Our accessors are enumerable:
|
Yeah, the PR is poorly named. If you look at the code it uses |
Good point, it would've worked if we'd have kept the enumerable check, I read that too quickly... |
jestjs/jest#409, removed without any context provided... I've asked, but haven't received a response yet |
@SimenB I assume you've asked within some private channel, could you, please, provide an update here? I'm intrigued 😃 |
Fixes: #21489 PR-URL: #21776 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
The breaking change is reverted on Node 10 (will be released with the next version) |
Fixes electron/electron#15543 by reverting 484140e. This commit was added to retain backwards compatibility in the 10.x branch and shouldn't be an issue in Node 11 / Electron based on 11.x. More info can be found at nodejs/node#21489
v10.5.0
Darwin Simens-MBP 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
fs
With the following file:
It prints the following in Node 10.4.1:
And the following in Node 10.5.0:
More concretely, the following is missing
(File){Read,Write}Stream
in 10.5.0, while they're present in 10.4.1:Source of that function: https://github.com/facebook/jest/blob/24df0751a818e570fe74dd0d73285a63e322d37f/packages/jest-mock/src/index.js#L642-L723
Probably related to #20764.
I'll add that this should probably be addressed in Jest, but this is potentially pretty breaking for consumers of Jest (of which not everybody will upgrade to the latest version).
In particular,
graceful-fs
completely breaks ifrequire
d after ajest.mock('fs');
Explodes with
The text was updated successfully, but these errors were encountered: