-
Notifications
You must be signed in to change notification settings - Fork 774
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
Fs-extra v8, copy function gives error when using with jest #687
Comments
Also getting this error. I haven't bothered to hunt down which function is causing it but in my case I'm not using |
hmm..! That's so weird! That error basically comes from |
wondering if we need to disable that in the |
Would be useful to have a non-jest example so we could get the full stack trace. |
@RyanZim I tried same example without jest (same node version 12.1.0) and it didn't give me error. const fs = require('fs-extra')
async function run() {
const src = 'tests/fixtures/src/asset.js'
const dest = 'tests/fixtures/dist/asset.js'
await fs.copy(src, dest)
}
run() |
My best attempt to get error: /Users/shcherbin/Sites/test/experiments/fs-extra-8-jest/node_modules/graceful-fs/polyfills.js:285
if (cb) cb.apply(this, arguments)
^
TypeError: cb.apply is not a function
at /Users/shcherbin/Sites/test/experiments/fs-extra-8-jest/node_modules/graceful-fs/polyfills.js:285:20
at FSReqCallback.oncomplete (fs.js:167:5) |
Jest globally monkey-patches the fs module itself: https://github.com/facebook/jest/blob/bcc2b103e14912cff566cbacb0c2c3871ecb0994/packages/jest-runtime/src/cli/index.ts#L26 See https://github.com/isaacs/node-graceful-fs#global-patching for details about this. IDK how best to work with this. Should fs-extra try to detect global monkey patching and run without |
The root problem is that graceful-fs is broken and needs updates. Not sure how to get action there. |
Yeah exactly! If |
Anybody opened a bug/issue report on this one? Seems like more and more projects are crashing. Jest is used prettify massively right now. |
The root issue is isaacs/node-graceful-fs#158; if we could get action there, we'd be good. |
|
Hm, I still seem to see the error with 8.1.0. I used
|
What version of graceful-fs is jest pulling in? |
Per an $ npm ls | grep graceful-fs
graceful-fs@4.2.0 |
I'd like to see the output of |
Just checked, the issue is fixed for me when using graceful-fs 4.2.0. |
I'm going to chalk it up to some problem in our project, I also can't
reproduce with a fresh project.
…On Mon, Jul 1, 2019, 1:33 PM Vlad Shcherbin ***@***.***> wrote:
Just checked, the issue is fixed for me when using graceful-fs 4.2.0.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#687?email_source=notifications&email_token=AABYNXOLXRLAHK3IDO4BDALP5I5WZA5CNFSM4HM62GN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY62NDI#issuecomment-507356813>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABYNXIOW7TE3T6U4ZIA57DP5I5WZANCNFSM4HM62GNQ>
.
|
@fastfrwrd Try doing a clean install/regenerating the lockfile. |
Yep, adding |
fs-extra
version: 8.0.1Hey, 👋
After updating
fs-extra
from v7 to v8, jest tests started to give error forcopy
function:Here is same reproduction repo with failing test. The repo has only two commits, one is with v7 and no error, second is just an update to v8 and with error.
I saw this from travis, which gave error for node v10 and v12, but not for v8. Here is travis log. Rollback to v7 removes error.
Any idea why this is happening? 🤔
The text was updated successfully, but these errors were encountered: