Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fs.promises.access does not reject, causes unhandled rejection #280

Closed
FINDarkside opened this issue Nov 5, 2019 · 0 comments · Fixed by #281
Closed

fs.promises.access does not reject, causes unhandled rejection #280

FINDarkside opened this issue Nov 5, 2019 · 0 comments · Fixed by #281

Comments

@FINDarkside
Copy link

FINDarkside commented Nov 5, 2019

Promise returned by fs.promises.access is not rejected when it should be.

Code to reproduce (4.10.3):

const mockFs = require('mock-fs');
mockFs({
    './tmp.json': Buffer.from('fileContent'),
});
const fs = require('fs').promises;

async function test() {
    await fs.access('./doesNotExist');
    console.log('success');
}

test();

Output:

success
(node:6292) UnhandledPromiseRejectionWarning: Error: ENOENT, UV_ENOENT '\\?\C:\Users\Username\Dir\mocfsTest\doesNotExist'
    at Object.<anonymous> (C:\Users\Username\Dir\mocfsTest\node_modules\mock-fs\lib\binding.js:1435:13)
    at maybeCallback (C:\Users\Username\Dir\mocfsTest\node_modules\mock-fs\lib\binding.js:57:18)
    at Object.Binding.access (C:\Users\Username\Dir\mocfsTest\node_modules\mock-fs\lib\binding.js:1423:3)
    at Object.<anonymous> (C:\Users\Username\Dir\mocfsTest\node_modules\mock-fs\lib\index.js:33:39)
    at Object.access (internal/fs/promises.js:188:18)
    at test (C:\Users\Username\Dir\mocfsTest\index.js:8:14)
    at Object.<anonymous> (C:\Users\Username\Dir\mocfsTest\index.js:12:1)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant