-
Notifications
You must be signed in to change notification settings - Fork 5
Fallback straight to JS if realpath.native/realpathSync.native throw an exception #36
Conversation
…ecause we're on a weird configuration like a RAMdisk on Windows. if so, fall straight back to default JS implementation.
Getting issues from commitlint, but those can probably be addressed when you squash the commit. |
Thanks for the PR!
No, that's intentional - there's no $ node -p "Object.keys(process.binding('fs')).sort()"
[ 'FSReqWrap',
'FileHandle',
'StatWatcher',
'access',
'bigintStatValues',
'chmod',
'chown',
'close',
'copyFile',
'fchmod',
'fchown',
'fdatasync',
'fstat',
'fsync',
'ftruncate',
'futimes',
'internalModuleReadJSON',
'internalModuleStat',
'kFsStatsFieldsLength',
'kUsePromises',
'lchown',
'link',
'lstat',
'mkdir',
'mkdtemp',
'open',
'openFileHandle',
'read',
'readdir',
'readlink',
'realpath',
'rename',
'rmdir',
'stat',
'statValues',
'symlink',
'unlink',
'utimes',
'writeBuffer',
'writeBuffers',
'writeString' ]
Yup, don't worry about those 🙂 |
…path for all cases
updated |
Sorry for not getting to this for so long. I'm still not finding a real clean solution for this - since the async versions are using promises, the only way to handle errors in the first call is to chain promises. If I have a callback chaining implementation at https://github.com/rvaidya/realpath-native/tree/feature/windowsRamdiskTry2 This commit doesn't try to refactor anything |
@rvaidya your solution in the linked branch seems OK to me, even though it turned out to be a bit of code. Wanna update this PR to that approach? |
I opened #39 - you can close this PR |
I've published a v3 and deprecated it - all current releases of node supports Jest 26 no longer depends on this module. |
if fs.realpath.native and fs.realpathSync.native crash, it could be because we're on a weird configuration like a RAMdisk on Windows. if so, fall straight back to default JS implementation.
Otherwise, the process.binding attempt may cause the node runtime to abort
I also refactored the code to reduce repetition. Let me know if that is ok.
I was unable to run test.js - getting errors doing npm install coming from "babel-helper-regex" and then getting "Cannot find module 'eslint-config-simenb-node'" when trying to run it anyways.
I tested by copying my updated index.js into my project folder under jest-config and running it that way.
This also fixes a potential typo: both realpath and realpathSync were calling realpath in the process.binding attempt, which was probably unintentional.