test: ensure never settling promises are detected

PR-URL: https://github.com/nodejs/node/pull/50318
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Antoine du Hamel 2023-10-23 19:55:50 +02:00 committed by GitHub
parent 2da66c1444
commit 8f742bb13f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 147 additions and 143 deletions

View File

@ -49,6 +49,8 @@ rules:
message: Use 'test' as debuglog value in tests. message: Use 'test' as debuglog value in tests.
- selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^must(Not)?Call/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"],[callee.name="mustNotCall"])>:first-child[type=/FunctionExpression$/][body.body.length=0] - selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^must(Not)?Call/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"],[callee.name="mustNotCall"])>:first-child[type=/FunctionExpression$/][body.body.length=0]
message: Do not use an empty function, omit the parameter altogether. message: Do not use an empty function, omit the parameter altogether.
- selector: ExpressionStatement>CallExpression:matches([callee.name='rejects'], [callee.object.name='assert'][callee.property.name='rejects'])
message: Calling `assert.rejects` without `await` or `.then(common.mustCall())` will not detect never-settling promises.
- selector: Identifier[name='webcrypto'] - selector: Identifier[name='webcrypto']
message: Use `globalThis.crypto`. message: Use `globalThis.crypto`.

View File

@ -23,55 +23,55 @@ const expectedPackageHack =
const expectedBare = errTemplate('deep-fail', 'comeOn', '{ comeOn }'); const expectedBare = errTemplate('deep-fail', 'comeOn', '{ comeOn }');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/single-quote.mjs`); await import(`${fixtureBase}/single-quote.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedRelative message: expectedRelative
}, 'should support relative specifiers with single quotes'); }, 'should support relative specifiers with single quotes');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/double-quote.mjs`); await import(`${fixtureBase}/double-quote.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedRelative message: expectedRelative
}, 'should support relative specifiers with double quotes'); }, 'should support relative specifiers with double quotes');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/renamed-import.mjs`); await import(`${fixtureBase}/renamed-import.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedRenamed message: expectedRenamed
}, 'should correctly format named imports with renames'); }, 'should correctly format named imports with renames');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/multi-line.mjs`); await import(`${fixtureBase}/multi-line.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedWithoutExample, message: expectedWithoutExample,
}, 'should correctly format named imports across multiple lines'); }, 'should correctly format named imports across multiple lines');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/json-hack.mjs`); await import(`${fixtureBase}/json-hack.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedPackageHack message: expectedPackageHack
}, 'should respect recursive package.json for module type'); }, 'should respect recursive package.json for module type');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/bare-import-single.mjs`); await import(`${fixtureBase}/bare-import-single.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedBare message: expectedBare
}, 'should support bare specifiers with single quotes'); }, 'should support bare specifiers with single quotes');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/bare-import-double.mjs`); await import(`${fixtureBase}/bare-import-double.mjs`);
}, { }, {
name: 'SyntaxError', name: 'SyntaxError',
message: expectedBare message: expectedBare
}, 'should support bare specifiers with double quotes'); }, 'should support bare specifiers with double quotes');
rejects(async () => { await rejects(async () => {
await import(`${fixtureBase}/escaped-single-quote.mjs`); await import(`${fixtureBase}/escaped-single-quote.mjs`);
}, /import pkg from '\.\/oh'no\.cjs'/, 'should support relative specifiers with escaped single quote'); }, /import pkg from '\.\/oh'no\.cjs'/, 'should support relative specifiers with escaped single quote');

View File

@ -17,7 +17,7 @@ assert.rejects(
code: 'ENOTFOUND', code: 'ENOTFOUND',
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`, message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
}, },
); ).then(common.mustCall());
assert.rejects( assert.rejects(
dnsPromises.lookup(addresses.NOT_FOUND, { dnsPromises.lookup(addresses.NOT_FOUND, {
@ -29,7 +29,7 @@ assert.rejects(
code: 'ENOTFOUND', code: 'ENOTFOUND',
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`, message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
}, },
); ).then(common.mustCall());
dns.lookup(addresses.NOT_FOUND, { dns.lookup(addresses.NOT_FOUND, {
hints: 0, hints: 0,

View File

@ -409,10 +409,10 @@ assert.throws(() => new Blob({}), {
} }
(async () => { (async () => {
assert.rejects(async () => Blob.prototype.arrayBuffer.call(), { await assert.rejects(async () => Blob.prototype.arrayBuffer.call(), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); });
assert.rejects(async () => Blob.prototype.text.call(), { await assert.rejects(async () => Blob.prototype.text.call(), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); });
})().then(common.mustCall()); })().then(common.mustCall());

View File

@ -16,7 +16,7 @@ subtle.importKey(
}, },
false, false,
[ 'encrypt', 'decrypt' ]) [ 'encrypt', 'decrypt' ])
.then((k) => { .then((k) =>
assert.rejects(() => { assert.rejects(() => {
return subtle.decrypt({ return subtle.decrypt({
name: 'AES-GCM', name: 'AES-GCM',
@ -25,5 +25,5 @@ subtle.importKey(
}, { }, {
name: 'OperationError', name: 'OperationError',
message: /The provided data is too small/, message: /The provided data is too small/,
}); })
}); ).then(common.mustCall());

View File

@ -1,14 +1,14 @@
'use strict'; 'use strict';
require('../common'); const common = require('../common');
const fixtures = require('../common/fixtures'); const fixtures = require('../common/fixtures');
const assert = require('assert'); const assert = require('assert');
const { pathToFileURL } = require('url'); const { pathToFileURL } = require('url');
{ {
assert.rejects(import('./'), /ERR_UNSUPPORTED_DIR_IMPORT/); assert.rejects(import('./'), /ERR_UNSUPPORTED_DIR_IMPORT/).then(common.mustCall());
assert.rejects( assert.rejects(
import(pathToFileURL(fixtures.path('packages', 'main'))), import(pathToFileURL(fixtures.path('packages', 'main'))),
/Did you mean/, /Did you mean/,
); ).then(common.mustCall());
} }

View File

@ -205,4 +205,4 @@ tickValue = 1;
// Should fail due to stub. // Should fail due to stub.
assert.rejects(dnsPromises.lookup('example.com'), assert.rejects(dnsPromises.lookup('example.com'),
{ code: 'ENOMEM', hostname: 'example.com' }); { code: 'ENOMEM', hostname: 'example.com' }).then(common.mustCall());

View File

@ -16,4 +16,4 @@ dnsPromises.lookupService('127.0.0.1', 22).then(common.mustCall((result) => {
assert.rejects( assert.rejects(
() => dnsPromises.lookupService('192.0.2.1', 22), () => dnsPromises.lookupService('192.0.2.1', 22),
{ code: /^(?:ENOTFOUND|EAI_AGAIN)$/ } { code: /^(?:ENOTFOUND|EAI_AGAIN)$/ }
); ).then(common.mustCall());

View File

@ -32,4 +32,4 @@ assert.rejects(
message: 'getnameinfo ENOENT 127.0.0.1', message: 'getnameinfo ENOENT 127.0.0.1',
syscall: 'getnameinfo' syscall: 'getnameinfo'
} }
); ).then(common.mustCall());

View File

@ -1,6 +1,6 @@
// Flags: --expose-internals // Flags: --expose-internals
'use strict'; 'use strict';
require('../common'); const common = require('../common');
const assert = require('assert'); const assert = require('assert');
const { internalBinding } = require('internal/test/binding'); const { internalBinding } = require('internal/test/binding');
const cares = internalBinding('cares_wrap'); const cares = internalBinding('cares_wrap');
@ -17,4 +17,4 @@ assert.rejects(
syscall: 'queryA', syscall: 'queryA',
hostname: 'example.org' hostname: 'example.org'
} }
); ).then(common.mustCall());

View File

@ -25,7 +25,7 @@ EE.emit('error', theErr);
// Verify it works with once // Verify it works with once
process.nextTick(() => EE.emit('error', theErr)); process.nextTick(() => EE.emit('error', theErr));
assert.rejects(EventEmitter.once(EE, 'notTriggered'), theErr); assert.rejects(EventEmitter.once(EE, 'notTriggered'), theErr).then(common.mustCall());
// Only error events trigger error monitor // Only error events trigger error monitor
EE.on('aEvent', common.mustCall()); EE.on('aEvent', common.mustCall());

View File

@ -33,8 +33,8 @@ assert.throws(() => openSync(__filename, 0, invalid), {
assert.rejects(openPromise(__filename, invalid), { assert.rejects(openPromise(__filename, invalid), {
code: 'ERR_OUT_OF_RANGE' code: 'ERR_OUT_OF_RANGE'
}); }).then(common.mustCall());
assert.rejects(openPromise(__filename, 0, invalid), { assert.rejects(openPromise(__filename, 0, invalid), {
code: 'ERR_OUT_OF_RANGE' code: 'ERR_OUT_OF_RANGE'
}); }).then(common.mustCall());

View File

@ -10,7 +10,7 @@ const fs = require('fs');
const fh = await fs.promises.open(__filename); const fh = await fs.promises.open(__filename);
fs.closeSync(fh.fd); fs.closeSync(fh.fd);
assert.rejects(() => fh.close(), { await assert.rejects(() => fh.close(), {
code: 'EBADF', code: 'EBADF',
syscall: 'close' syscall: 'close'
}); });

View File

@ -16,7 +16,7 @@ const fs = require('fs').promises;
// See https://github.com/nodejs/node/issues/31361 for more details. // See https://github.com/nodejs/node/issues/31361 for more details.
const otherFilehandle = await fs.open(process.execPath); const otherFilehandle = await fs.open(process.execPath);
assert.rejects(() => filehandle.stat(), { await assert.rejects(() => filehandle.stat(), {
code: 'EBADF', code: 'EBADF',
syscall: 'fstat' syscall: 'fstat'
}); });

View File

@ -42,7 +42,7 @@ assert.throws(() => fs.lchmod(f, {}), { code: 'ERR_INVALID_ARG_TYPE' });
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
}; };
assert.rejects(promises.lchmod(f, input, () => {}), errObj); assert.rejects(promises.lchmod(f, input, () => {}), errObj).then(common.mustCall());
assert.throws(() => fs.lchmodSync(f, input), errObj); assert.throws(() => fs.lchmodSync(f, input), errObj);
}); });
@ -61,6 +61,6 @@ assert.throws(() => fs.lchmodSync(f, '123x'), {
`4294967295. Received ${input}` `4294967295. Received ${input}`
}; };
assert.rejects(promises.lchmod(f, input, () => {}), errObj); assert.rejects(promises.lchmod(f, input, () => {}), errObj).then(common.mustCall());
assert.throws(() => fs.lchmodSync(f, input), errObj); assert.throws(() => fs.lchmodSync(f, input), errObj);
}); });

View File

@ -94,7 +94,7 @@ for (const extra of [[], ['r'], ['r', 0], ['r', 0, 'bad callback']]) {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError' name: 'TypeError'
} }
); ).then(common.mustCall());
}); });
// Check invalid modes. // Check invalid modes.
@ -116,5 +116,5 @@ for (const extra of [[], ['r'], ['r', 0], ['r', 0, 'bad callback']]) {
{ {
code: 'ERR_INVALID_ARG_TYPE' code: 'ERR_INVALID_ARG_TYPE'
} }
); ).then(common.mustCall());
}); });

View File

@ -46,7 +46,7 @@ function validateReadFileAbortLogicBefore() {
const signal = AbortSignal.abort(); const signal = AbortSignal.abort();
assert.rejects(readFile(fn, { signal }), { assert.rejects(readFile(fn, { signal }), {
name: 'AbortError' name: 'AbortError'
}); }).then(common.mustCall());
} }
function validateReadFileAbortLogicDuring() { function validateReadFileAbortLogicDuring() {
@ -55,7 +55,7 @@ function validateReadFileAbortLogicDuring() {
process.nextTick(() => controller.abort()); process.nextTick(() => controller.abort());
assert.rejects(readFile(fn, { signal }), { assert.rejects(readFile(fn, { signal }), {
name: 'AbortError' name: 'AbortError'
}); }).then(common.mustCall());
} }
async function validateWrongSignalParam() { async function validateWrongSignalParam() {

View File

@ -79,42 +79,42 @@ assert.rejects(
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch(1)) { } for await (const _ of watch(1)) { }
}, },
{ code: 'ERR_INVALID_ARG_TYPE' }); { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall());
assert.rejects( assert.rejects(
async () => { async () => {
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch(__filename, 1)) { } for await (const _ of watch(__filename, 1)) { }
}, },
{ code: 'ERR_INVALID_ARG_TYPE' }); { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall());
assert.rejects( assert.rejects(
async () => { async () => {
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch('', { persistent: 1 })) { } for await (const _ of watch('', { persistent: 1 })) { }
}, },
{ code: 'ERR_INVALID_ARG_TYPE' }); { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall());
assert.rejects( assert.rejects(
async () => { async () => {
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch('', { recursive: 1 })) { } for await (const _ of watch('', { recursive: 1 })) { }
}, },
{ code: 'ERR_INVALID_ARG_TYPE' }); { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall());
assert.rejects( assert.rejects(
async () => { async () => {
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch('', { encoding: 1 })) { } for await (const _ of watch('', { encoding: 1 })) { }
}, },
{ code: 'ERR_INVALID_ARG_VALUE' }); { code: 'ERR_INVALID_ARG_VALUE' }).then(common.mustCall());
assert.rejects( assert.rejects(
async () => { async () => {
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch('', { signal: 1 })) { } for await (const _ of watch('', { signal: 1 })) { }
}, },
{ code: 'ERR_INVALID_ARG_TYPE' }); { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall());
(async () => { (async () => {
const ac = new AbortController(); const ac = new AbortController();

View File

@ -59,21 +59,21 @@ assert.strictEqual(
name: 'Error', name: 'Error',
message: /^ENOENT: no such file or directory, access/ message: /^ENOENT: no such file or directory, access/
} }
); ).then(common.mustCall());
assert.rejects( assert.rejects(
access(__filename, 8), access(__filename, 8),
{ {
code: 'ERR_OUT_OF_RANGE', code: 'ERR_OUT_OF_RANGE',
} }
); ).then(common.mustCall());
assert.rejects( assert.rejects(
access(__filename, { [Symbol.toPrimitive]() { return 5; } }), access(__filename, { [Symbol.toPrimitive]() { return 5; } }),
{ {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
} }
); ).then(common.mustCall());
} }
function verifyStatObject(stat) { function verifyStatObject(stat) {
@ -407,7 +407,7 @@ async function executeOnHandle(dest, func) {
const dir = path.join(tmpDir, nextdir(), nextdir()); const dir = path.join(tmpDir, nextdir(), nextdir());
await mkdir(path.dirname(dir)); await mkdir(path.dirname(dir));
await writeFile(dir, ''); await writeFile(dir, '');
assert.rejects( await assert.rejects(
mkdir(dir, { recursive: true }), mkdir(dir, { recursive: true }),
{ {
code: 'EEXIST', code: 'EEXIST',
@ -424,7 +424,7 @@ async function executeOnHandle(dest, func) {
const dir = path.join(file, nextdir(), nextdir()); const dir = path.join(file, nextdir(), nextdir());
await mkdir(path.dirname(file)); await mkdir(path.dirname(file));
await writeFile(file, ''); await writeFile(file, '');
assert.rejects( await assert.rejects(
mkdir(dir, { recursive: true }), mkdir(dir, { recursive: true }),
{ {
code: 'ENOTDIR', code: 'ENOTDIR',
@ -463,14 +463,14 @@ async function executeOnHandle(dest, func) {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError' name: 'TypeError'
} }
); ).then(common.mustCall());
}); });
} }
// `mkdtemp` with invalid numeric prefix // `mkdtemp` with invalid numeric prefix
{ {
await mkdtemp(path.resolve(tmpDir, 'FOO')); await mkdtemp(path.resolve(tmpDir, 'FOO'));
assert.rejects( await assert.rejects(
// mkdtemp() expects to get a string prefix. // mkdtemp() expects to get a string prefix.
async () => mkdtemp(1), async () => mkdtemp(1),
{ {

View File

@ -37,5 +37,5 @@ assert.throws(
message: 'The argument \'buffer\' is empty and cannot be written. ' + message: 'The argument \'buffer\' is empty and cannot be written. ' +
'Received Uint8Array(0) []' 'Received Uint8Array(0) []'
} }
); ).then(common.mustCall());
})().then(common.mustCall()); })().then(common.mustCall());

View File

@ -114,7 +114,7 @@ const kArrayBuffer =
writer.close(); writer.close();
}, 10); }, 10);
assert.rejects(blob(readable), { code: 'ERR_INVALID_STATE' }); assert.rejects(blob(readable), { code: 'ERR_INVALID_STATE' }).then(common.mustCall());
} }
{ {
@ -132,7 +132,7 @@ const kArrayBuffer =
writer.close(); writer.close();
}, 10); }, 10);
assert.rejects(arrayBuffer(readable), { code: 'ERR_INVALID_STATE' }); assert.rejects(arrayBuffer(readable), { code: 'ERR_INVALID_STATE' }).then(common.mustCall());
} }
{ {
@ -150,7 +150,7 @@ const kArrayBuffer =
writer.close(); writer.close();
}, 10); }, 10);
assert.rejects(text(readable), { code: 'ERR_INVALID_STATE' }); assert.rejects(text(readable), { code: 'ERR_INVALID_STATE' }).then(common.mustCall());
} }
{ {
@ -168,7 +168,7 @@ const kArrayBuffer =
writer.close(); writer.close();
}, 10); }, 10);
assert.rejects(json(readable), { code: 'ERR_INVALID_STATE' }); assert.rejects(json(readable), { code: 'ERR_INVALID_STATE' }).then(common.mustCall());
} }
{ {
@ -227,7 +227,7 @@ const kArrayBuffer =
assert.rejects(text(stream), { assert.rejects(text(stream), {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
}); }).then(common.mustCall());
stream.write({}); stream.write({});
stream.end({}); stream.end({});
@ -241,7 +241,7 @@ const kArrayBuffer =
assert.rejects(json(stream), { assert.rejects(json(stream), {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
}); }).then(common.mustCall());
stream.write({}); stream.write({});
stream.end({}); stream.end({});

View File

@ -318,7 +318,7 @@ const assert = require('assert');
assert.rejects((async () => { assert.rejects((async () => {
// eslint-disable-next-line no-unused-vars, no-empty // eslint-disable-next-line no-unused-vars, no-empty
for await (const chunk of read) { } for await (const chunk of read) { }
})(), /AbortError/); })(), /AbortError/).then(common.mustCall());
setTimeout(() => controller.abort(), 0); setTimeout(() => controller.abort(), 0);
} }

View File

@ -119,10 +119,10 @@ function sum(p, c) {
{ {
// Error cases // Error cases
assert.rejects(() => Readable.from([]).reduce(1), /TypeError/); assert.rejects(() => Readable.from([]).reduce(1), /TypeError/).then(common.mustCall());
assert.rejects(() => Readable.from([]).reduce('5'), /TypeError/); assert.rejects(() => Readable.from([]).reduce('5'), /TypeError/).then(common.mustCall());
assert.rejects(() => Readable.from([]).reduce((x, y) => x + y, 0, 1), /ERR_INVALID_ARG_TYPE/); assert.rejects(() => Readable.from([]).reduce((x, y) => x + y, 0, 1), /ERR_INVALID_ARG_TYPE/).then(common.mustCall());
assert.rejects(() => Readable.from([]).reduce((x, y) => x + y, 0, { signal: true }), /ERR_INVALID_ARG_TYPE/); assert.rejects(() => Readable.from([]).reduce((x, y) => x + y, 0, { signal: true }), /ERR_INVALID_ARG_TYPE/).then(common.mustCall());
} }
{ {

View File

@ -2,7 +2,7 @@
// Flags: --experimental-vm-modules // Flags: --experimental-vm-modules
require('../common'); const common = require('../common');
const assert = require('assert'); const assert = require('assert');
const { SourceTextModule } = require('vm'); const { SourceTextModule } = require('vm');
@ -27,4 +27,4 @@ assert.rejects(async () => {
m.createCachedData(); m.createCachedData();
}, { }, {
code: 'ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA', code: 'ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA',
}); }).then(common.mustCall());

View File

@ -39,4 +39,4 @@ assert.rejects(async () => {
}, { }, {
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT', code: 'ERR_SCRIPT_EXECUTION_TIMEOUT',
message: 'Script execution timed out after 5ms' message: 'Script execution timed out after 5ms'
}); }).then(common.mustCall());

View File

@ -366,11 +366,11 @@ async function testImportRaw({ name, publicUsages }) {
'spki', 'spki',
rsaPublic.export({ format: 'der', type: 'spki' }), rsaPublic.export({ format: 'der', type: 'spki' }),
{ name }, { name },
true, publicUsages), { message: /Invalid key type/ }); true, publicUsages), { message: /Invalid key type/ }).then(common.mustCall());
assert.rejects(subtle.importKey( assert.rejects(subtle.importKey(
'pkcs8', 'pkcs8',
rsaPrivate.export({ format: 'der', type: 'pkcs8' }), rsaPrivate.export({ format: 'der', type: 'pkcs8' }),
{ name }, { name },
true, privateUsages), { message: /Invalid key type/ }); true, privateUsages), { message: /Invalid key type/ }).then(common.mustCall());
} }
} }

View File

@ -565,11 +565,11 @@ const testVectors = [
'spki', 'spki',
ecPublic.export({ format: 'der', type: 'spki' }), ecPublic.export({ format: 'der', type: 'spki' }),
{ name, hash: 'SHA-256' }, { name, hash: 'SHA-256' },
true, [publicUsage]), { message: /Invalid key type/ }); true, [publicUsage]), { message: /Invalid key type/ }).then(common.mustCall());
assert.rejects(subtle.importKey( assert.rejects(subtle.importKey(
'pkcs8', 'pkcs8',
ecPrivate.export({ format: 'der', type: 'pkcs8' }), ecPrivate.export({ format: 'der', type: 'pkcs8' }),
{ name, hash: 'SHA-256' }, { name, hash: 'SHA-256' },
true, [privateUsage]), { message: /Invalid key type/ }); true, [privateUsage]), { message: /Invalid key type/ }).then(common.mustCall());
} }
} }

View File

@ -1,7 +1,7 @@
// Flags: --expose-internals // Flags: --expose-internals
'use strict'; 'use strict';
require('../common'); const common = require('../common');
const assert = require('node:assert'); const assert = require('node:assert');
const { AbortError } = require('internal/errors'); const { AbortError } = require('internal/errors');
@ -20,5 +20,5 @@ for (const message of [undefined, 'abc']) {
assert.strictEqual(e.name, 'AbortError'); assert.strictEqual(e.name, 'AbortError');
assert.strictEqual(e.message, reason.message); assert.strictEqual(e.message, reason.message);
return true; return true;
}); }).then(common.mustCall());
} }

View File

@ -184,7 +184,7 @@ class Source {
throw error; throw error;
} }
assert.rejects(read(stream), error); assert.rejects(read(stream), error).then(common.mustCall());
} }
{ {
@ -212,10 +212,10 @@ class Source {
reader.releaseLock(); reader.releaseLock();
assert.rejects(reader.read(new Uint8Array(10)), { assert.rejects(reader.read(new Uint8Array(10)), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.rejects(reader.cancel(), { assert.rejects(reader.cancel(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
} }
{ {

View File

@ -355,11 +355,11 @@ assert.throws(() => {
assert.rejects(reader.read(), { assert.rejects(reader.read(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.rejects(closedBefore, { assert.rejects(closedBefore, {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
} }
{ {
@ -391,7 +391,7 @@ assert.throws(() => {
assert.rejects(stream.cancel(), { assert.rejects(stream.cancel(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
reader.cancel(); reader.cancel();
@ -483,7 +483,7 @@ assert.throws(() => {
closedBefore.then(common.mustCall()); closedBefore.then(common.mustCall());
assert.rejects(closedAfter, { assert.rejects(closedAfter, {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
} }
{ {
@ -505,7 +505,7 @@ assert.throws(() => {
closedBefore.then(common.mustCall()); closedBefore.then(common.mustCall());
assert.rejects(closedAfter, { assert.rejects(closedAfter, {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
} }
{ {
@ -579,9 +579,9 @@ assert.throws(() => {
}); });
stream.getReader().releaseLock(); stream.getReader().releaseLock();
const reader = stream.getReader(); const reader = stream.getReader();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
assert.rejects(reader.read(), error); assert.rejects(reader.read(), error).then(common.mustCall());
assert.rejects(reader.read(), error); assert.rejects(reader.read(), error).then(common.mustCall());
} }
{ {
@ -595,8 +595,8 @@ assert.throws(() => {
const cancel1 = reader.cancel(); const cancel1 = reader.cancel();
const cancel2 = reader.cancel(); const cancel2 = reader.cancel();
assert.notStrictEqual(cancel1, cancel2); assert.notStrictEqual(cancel1, cancel2);
assert.rejects(cancel1, error); assert.rejects(cancel1, error).then(common.mustCall());
assert.rejects(cancel2, error); assert.rejects(cancel2, error).then(common.mustCall());
} }
{ {
@ -608,9 +608,9 @@ assert.throws(() => {
}); });
stream.getReader().releaseLock(); stream.getReader().releaseLock();
const reader = stream.getReader(); const reader = stream.getReader();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
assert.rejects(reader.read(), error); assert.rejects(reader.read(), error).then(common.mustCall());
assert.rejects(reader.read(), error); assert.rejects(reader.read(), error).then(common.mustCall());
} }
{ {
@ -717,8 +717,10 @@ assert.throws(() => {
assert.notStrictEqual(closed1, closed2); assert.notStrictEqual(closed1, closed2);
assert.rejects(closed1, error); assert.rejects(closed1, error).then(common.mustCall());
assert.rejects(closed2, error); assert.rejects(closed2, error).then(common.mustCall());
reader1.read();
} }
{ {
@ -796,8 +798,8 @@ assert.throws(() => {
const { 0: s1, 1: s2 } = stream.tee(); const { 0: s1, 1: s2 } = stream.tee();
assert.rejects(s1.cancel(), error); assert.rejects(s1.cancel(), error).then(common.mustCall());
assert.rejects(s2.cancel(), error); assert.rejects(s2.cancel(), error).then(common.mustCall());
} }
{ {
@ -812,8 +814,8 @@ assert.throws(() => {
const { 0: s1, 1: s2 } = stream.tee(); const { 0: s1, 1: s2 } = stream.tee();
c.error(error); c.error(error);
assert.rejects(s1.cancel(), error); assert.rejects(s1.cancel(), error).then(common.mustCall());
assert.rejects(s2.cancel(), error); assert.rejects(s2.cancel(), error).then(common.mustCall());
} }
{ {
@ -830,11 +832,11 @@ assert.throws(() => {
const reader1 = s1.getReader(); const reader1 = s1.getReader();
const reader2 = s2.getReader(); const reader2 = s2.getReader();
assert.rejects(reader1.closed, error); assert.rejects(reader1.closed, error).then(common.mustCall());
assert.rejects(reader2.closed, error); assert.rejects(reader2.closed, error).then(common.mustCall());
assert.rejects(reader1.read(), error); assert.rejects(reader1.read(), error).then(common.mustCall());
assert.rejects(reader2.read(), error); assert.rejects(reader2.read(), error).then(common.mustCall());
setImmediate(() => c.error(error)); setImmediate(() => c.error(error));
} }
@ -1038,7 +1040,7 @@ assert.throws(() => {
const reader = stream.getReader(); const reader = stream.getReader();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
} }
{ {
@ -1053,7 +1055,7 @@ assert.throws(() => {
const reader = stream.getReader(); const reader = stream.getReader();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
} }
{ {
@ -1357,7 +1359,7 @@ class Source {
}); });
assert.rejects(() => ReadableStream.prototype.cancel.call({}), { assert.rejects(() => ReadableStream.prototype.cancel.call({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws(() => ReadableStream.prototype.getReader.call({}), { assert.throws(() => ReadableStream.prototype.getReader.call({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); });
@ -1372,15 +1374,15 @@ class Source {
}); });
assert.rejects(() => ReadableStreamDefaultReader.prototype.read.call({}), { assert.rejects(() => ReadableStreamDefaultReader.prototype.read.call({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects(() => ReadableStreamDefaultReader.prototype.cancel.call({}), { assert.rejects(() => ReadableStreamDefaultReader.prototype.cancel.call({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects(() => { assert.rejects(() => {
return Reflect.get(ReadableStreamDefaultReader.prototype, 'closed'); return Reflect.get(ReadableStreamDefaultReader.prototype, 'closed');
}, { }, {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws(() => { assert.throws(() => {
ReadableStreamDefaultReader.prototype.releaseLock.call({}); ReadableStreamDefaultReader.prototype.releaseLock.call({});
}, { }, {
@ -1388,7 +1390,7 @@ class Source {
}); });
assert.rejects(() => ReadableStreamBYOBReader.prototype.read.call({}), { assert.rejects(() => ReadableStreamBYOBReader.prototype.read.call({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws(() => { assert.throws(() => {
ReadableStreamBYOBReader.prototype.releaseLock.call({}); ReadableStreamBYOBReader.prototype.releaseLock.call({});
}, { }, {
@ -1398,10 +1400,10 @@ class Source {
return Reflect.get(ReadableStreamBYOBReader.prototype, 'closed'); return Reflect.get(ReadableStreamBYOBReader.prototype, 'closed');
}, { }, {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects(() => ReadableStreamBYOBReader.prototype.cancel.call({}), { assert.rejects(() => ReadableStreamBYOBReader.prototype.cancel.call({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws(() => { assert.throws(() => {
Reflect.get(ReadableByteStreamController.prototype, 'byobRequest', {}); Reflect.get(ReadableByteStreamController.prototype, 'byobRequest', {});
@ -1484,11 +1486,11 @@ class Source {
assert.rejects(readableStreamPipeTo(1), { assert.rejects(readableStreamPipeTo(1), {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
}); }).then(common.mustCall());
assert.rejects(readableStreamPipeTo(new ReadableStream(), 1), { assert.rejects(readableStreamPipeTo(new ReadableStream(), 1), {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
}); }).then(common.mustCall());
assert.rejects( assert.rejects(
readableStreamPipeTo( readableStreamPipeTo(
@ -1500,7 +1502,7 @@ class Source {
{}), {}),
{ {
code: 'ERR_INVALID_ARG_TYPE', code: 'ERR_INVALID_ARG_TYPE',
}); }).then(common.mustCall());
} }
{ {
@ -1510,10 +1512,10 @@ class Source {
reader.releaseLock(); reader.releaseLock();
assert.rejects(reader.read(), { assert.rejects(reader.read(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.rejects(reader.cancel(), { assert.rejects(reader.cancel(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
} }
{ {

View File

@ -60,7 +60,7 @@ const {
assert.rejects(reader.closed, { assert.rejects(reader.closed, {
code: 'ABORT_ERR', code: 'ABORT_ERR',
}); }).then(common.mustCall());
readable.on('end', common.mustNotCall()); readable.on('end', common.mustNotCall());
readable.on('error', common.mustNotCall()); readable.on('error', common.mustNotCall());
@ -116,7 +116,7 @@ const {
const reader = readableStream.getReader(); const reader = readableStream.getReader();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
readable.on('end', common.mustNotCall()); readable.on('end', common.mustNotCall());
readable.on('error', common.mustCall((reason) => { readable.on('error', common.mustCall((reason) => {

View File

@ -28,11 +28,11 @@ const {
assert.rejects(reader.closed, { assert.rejects(reader.closed, {
code: 'ABORT_ERR', code: 'ABORT_ERR',
}); }).then(common.mustCall());
assert.rejects(writer.closed, { assert.rejects(writer.closed, {
code: 'ABORT_ERR', code: 'ABORT_ERR',
}); }).then(common.mustCall());
duplex.destroy(); duplex.destroy();
@ -58,8 +58,8 @@ const {
const reader = readable.getReader(); const reader = readable.getReader();
const writer = writable.getWriter(); const writer = writable.getWriter();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
assert.rejects(writer.closed, error); assert.rejects(writer.closed, error).then(common.mustCall());
duplex.destroy(error); duplex.destroy(error);
} }
@ -81,7 +81,7 @@ const {
const writer = writable.getWriter(); const writer = writable.getWriter();
reader.closed.then(common.mustCall()); reader.closed.then(common.mustCall());
assert.rejects(writer.closed, error); assert.rejects(writer.closed, error).then(common.mustCall());
reader.cancel(error).then(common.mustCall()); reader.cancel(error).then(common.mustCall());
} }
@ -121,8 +121,8 @@ const {
const reader = readable.getReader(); const reader = readable.getReader();
const writer = writable.getWriter(); const writer = writable.getWriter();
assert.rejects(reader.closed, error); assert.rejects(reader.closed, error).then(common.mustCall());
assert.rejects(writer.closed, error); assert.rejects(writer.closed, error).then(common.mustCall());
writer.abort(error).then(common.mustCall()); writer.abort(error).then(common.mustCall());
} }
@ -145,7 +145,7 @@ const {
assert.rejects(writer.closed, { assert.rejects(writer.closed, {
code: 'ABORT_ERR', code: 'ABORT_ERR',
}); }).then(common.mustCall());
reader.cancel(); reader.cancel();
} }
@ -166,7 +166,7 @@ const {
reader.closed.then(common.mustCall()); reader.closed.then(common.mustCall());
assert.rejects(writer.closed, { assert.rejects(writer.closed, {
code: 'ABORT_ERR', code: 'ABORT_ERR',
}); }).then(common.mustCall());
duplex.end(); duplex.end();
} }

View File

@ -56,10 +56,10 @@ class MySource {
assert.rejects(readableStream.cancel(), { assert.rejects(readableStream.cancel(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.rejects(readableStream.pipeTo(new WritableStream()), { assert.rejects(readableStream.pipeTo(new WritableStream()), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.throws(() => readableStream.tee(), { assert.throws(() => readableStream.tee(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); });

View File

@ -125,11 +125,11 @@ class TestSource {
assert.rejects(writableStream.close(), { assert.rejects(writableStream.close(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.rejects(writableStream.abort(), { assert.rejects(writableStream.abort(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',
}); }).then(common.mustCall());
assert.throws(() => writableStream.getWriter(), { assert.throws(() => writableStream.getWriter(), {
code: 'ERR_INVALID_STATE', code: 'ERR_INVALID_STATE',

View File

@ -81,7 +81,7 @@ class TestWritable extends Writable {
const writable = new TestWritable(); const writable = new TestWritable();
const writableStream = newWritableStreamFromStreamWritable(writable); const writableStream = newWritableStreamFromStreamWritable(writable);
assert.rejects(writableStream.close(), error); assert.rejects(writableStream.close(), error).then(common.mustCall());
writable.destroy(error); writable.destroy(error);
} }
@ -93,7 +93,7 @@ class TestWritable extends Writable {
assert.rejects(writableStream.close(), { assert.rejects(writableStream.close(), {
code: 'ABORT_ERR' code: 'ABORT_ERR'
}); }).then(common.mustCall());
writable.end(); writable.end();
} }

View File

@ -326,7 +326,7 @@ const theData = 'hello';
assert.rejects(reader.read(), { assert.rejects(reader.read(), {
code: 25, code: 25,
name: 'DataCloneError', name: 'DataCloneError',
}); }).then(common.mustCall());
port1.close(); port1.close();
}; };
@ -377,7 +377,7 @@ const theData = 'hello';
assert.rejects(writer.closed, { assert.rejects(writer.closed, {
code: 25, code: 25,
name: 'DataCloneError', name: 'DataCloneError',
}); }).then(common.mustCall());
writer.write(notActuallyTransferable).then(common.mustCall()); writer.write(notActuallyTransferable).then(common.mustCall());
@ -407,7 +407,7 @@ const theData = 'hello';
port1.onmessage = common.mustCall(({ data }) => { port1.onmessage = common.mustCall(({ data }) => {
const writer = data.getWriter(); const writer = data.getWriter();
assert.rejects(writer.closed, error); assert.rejects(writer.closed, error).then(common.mustCall());
writer.abort(error).then(common.mustCall()); writer.abort(error).then(common.mustCall());
port1.close(); port1.close();
@ -438,7 +438,7 @@ const theData = 'hello';
assert.rejects(writer.abort(m), { assert.rejects(writer.abort(m), {
code: 25, code: 25,
name: 'DataCloneError', name: 'DataCloneError',
}); }).then(common.mustCall());
port1.close(); port1.close();
}); });
@ -531,7 +531,7 @@ const theData = 'hello';
assert.rejects(cancel, { assert.rejects(cancel, {
code: 25, code: 25,
name: 'DataCloneError', name: 'DataCloneError',
}); }).then(common.mustCall());
port1.close(); port1.close();
}); });
@ -557,7 +557,7 @@ const theData = 'hello';
const m = new WebAssembly.Memory({ initial: 1 }); const m = new WebAssembly.Memory({ initial: 1 });
const writer = data.getWriter(); const writer = data.getWriter();
const write = writer.write(m); const write = writer.write(m);
assert.rejects(write, { code: 25, name: 'DataCloneError' }); assert.rejects(write, { code: 25, name: 'DataCloneError' }).then(common.mustCall());
port1.close(); port1.close();
}); });

View File

@ -129,7 +129,7 @@ class Sink {
const writer = stream.getWriter(); const writer = stream.getWriter();
assert.rejects(writer.closed, error); assert.rejects(writer.closed, error).then(common.mustCall());
writer.abort(error).then(common.mustCall(() => { writer.abort(error).then(common.mustCall(() => {
assert.strictEqual(stream[kState].state, 'errored'); assert.strictEqual(stream[kState].state, 'errored');
@ -163,10 +163,10 @@ class Sink {
}); });
assert.rejects(() => WritableStream.prototype.abort({}), { assert.rejects(() => WritableStream.prototype.abort({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects(() => WritableStream.prototype.close({}), { assert.rejects(() => WritableStream.prototype.close({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws(() => WritableStream.prototype.getWriter.call(), { assert.throws(() => WritableStream.prototype.getWriter.call(), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); });
@ -176,24 +176,24 @@ class Sink {
assert.rejects( assert.rejects(
Reflect.get(WritableStreamDefaultWriter.prototype, 'closed'), { Reflect.get(WritableStreamDefaultWriter.prototype, 'closed'), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects( assert.rejects(
Reflect.get(WritableStreamDefaultWriter.prototype, 'ready'), { Reflect.get(WritableStreamDefaultWriter.prototype, 'ready'), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws( assert.throws(
() => Reflect.get(WritableStreamDefaultWriter.prototype, 'desiredSize'), { () => Reflect.get(WritableStreamDefaultWriter.prototype, 'desiredSize'), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); });
assert.rejects(WritableStreamDefaultWriter.prototype.abort({}), { assert.rejects(WritableStreamDefaultWriter.prototype.abort({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects(WritableStreamDefaultWriter.prototype.close({}), { assert.rejects(WritableStreamDefaultWriter.prototype.close({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.rejects(WritableStreamDefaultWriter.prototype.write({}), { assert.rejects(WritableStreamDefaultWriter.prototype.write({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); }).then(common.mustCall());
assert.throws(() => WritableStreamDefaultWriter.prototype.releaseLock({}), { assert.throws(() => WritableStreamDefaultWriter.prototype.releaseLock({}), {
code: 'ERR_INVALID_THIS', code: 'ERR_INVALID_THIS',
}); });

View File

@ -30,7 +30,7 @@ const { once } = require('events');
assert.deepStrictEqual(await fh2.readFile(), await fs.readFile(__filename)); assert.deepStrictEqual(await fh2.readFile(), await fs.readFile(__filename));
await fh2.close(); await fh2.close();
assert.rejects(() => fh.readFile(), { code: 'EBADF' }); await assert.rejects(() => fh.readFile(), { code: 'EBADF' });
})().then(common.mustCall()); })().then(common.mustCall());
(async function() { (async function() {

View File

@ -39,4 +39,4 @@ assert.rejects(async () => {
}, { }, {
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT', code: 'ERR_SCRIPT_EXECUTION_TIMEOUT',
message: 'Script execution timed out after 10ms' message: 'Script execution timed out after 10ms'
}); }).then(common.mustCall());

View File

@ -1,5 +1,5 @@
'use strict'; 'use strict';
require('../common'); const common = require('../common');
if (process.argv[2] === 'wasi-child') { if (process.argv[2] === 'wasi-child') {
const assert = require('assert'); const assert = require('assert');
@ -23,7 +23,7 @@ if (process.argv[2] === 'wasi-child') {
name: 'Error', name: 'Error',
code: 'ERR_WASI_NOT_STARTED', code: 'ERR_WASI_NOT_STARTED',
message: 'wasi.start() has not been called', message: 'wasi.start() has not been called',
}); }).then(common.mustCall());
} else { } else {
const assert = require('assert'); const assert = require('assert');
const cp = require('child_process'); const cp = require('child_process');