MCPcopy Create free account
hub / github.com/nodejs/node / explicitCall

Function explicitCall

test/parallel/test-fs-promises-file-handle-dispose.js:7–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5const { opendirSync, promises: fs } = require('fs');
6
7async function explicitCall() {
8 const fh = await fs.open(__filename);
9 fh.on('close', common.mustCall());
10 await fh[Symbol.asyncDispose]();
11
12 const dh = await fs.opendir(__dirname);
13 await dh[Symbol.asyncDispose]();
14 // Repeat invocations should not reject
15 await dh[Symbol.asyncDispose]();
16 await assert.rejects(dh.read(), { code: 'ERR_DIR_CLOSED' });
17
18 const dhSync = opendirSync(__dirname);
19 dhSync[Symbol.dispose]();
20 // Repeat invocations should not throw
21 dhSync[Symbol.dispose]();
22 assert.throws(() => dhSync.readSync(), { code: 'ERR_DIR_CLOSED' });
23}
24
25async function implicitCall() {
26 let fh;

Calls 6

opendirSyncFunction · 0.85
opendirMethod · 0.80
openMethod · 0.65
onMethod · 0.45
readMethod · 0.45
readSyncMethod · 0.45

Tested by

no test coverage detected