Open
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
fs.promises.open
resolves with a FileHandle
object when given an non-existing file path.
The correct behavior should be throwing an error with code ENOENT
.
To reproduce
await packageJsonAndInstall({
dependencies: {
'tslib': '*',
},
})
const realPath = await node(`require.resolve('tslib/package.json')`)
const fakePath = `${realPath}.fake`
const result = await node(`
require('fs/promises')
.open(${JSON.stringify(fakePath)})
.then(() => 'resolved')
.catch((err) => \`rejected: \${err.code}\`)
`)
expect(result).toBe('rejected: ENOENT')
Environment
System:
OS: Linux 5.10 Alpine Linux
CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
Binaries:
Node: 16.17.1 - /tmp/xfs-28478f54/node
Yarn: 3.2.3 - /tmp/xfs-28478f54/yarn
npm: 8.15.0 - /usr/local/bin/npm
Additional context
No response