diff --git a/test/es-module/test-esm-error-cache.js b/test/es-module/test-esm-error-cache.js index b13e793626876a..d780f1a22164d7 100644 --- a/test/es-module/test-esm-error-cache.js +++ b/test/es-module/test-esm-error-cache.js @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const file = '../fixtures/syntax/bad_syntax.mjs'; @@ -23,4 +23,4 @@ let error; return true; } ); -})(); +})().then(common.mustCall()); diff --git a/test/es-module/test-esm-import-meta-resolve.mjs b/test/es-module/test-esm-import-meta-resolve.mjs index faf9320a82745a..911225e13c9d66 100644 --- a/test/es-module/test-esm-import-meta-resolve.mjs +++ b/test/es-module/test-esm-import-meta-resolve.mjs @@ -1,5 +1,5 @@ // Flags: --experimental-import-meta-resolve -import '../common/index.mjs'; +import { mustCall } from '../common/index.mjs'; import assert from 'assert'; const dirname = import.meta.url.slice(0, import.meta.url.lastIndexOf('/') + 1); @@ -21,4 +21,4 @@ const fixtures = dirname.slice(0, dirname.lastIndexOf('/', dirname.length - 2) + assert.strictEqual(await import.meta.resolve('../fixtures/'), fixtures); assert.strictEqual(await import.meta.resolve('baz/', fixtures), fixtures + 'node_modules/baz/'); -})(); +})().then(mustCall()); diff --git a/test/internet/test-dns-promises-resolve.js b/test/internet/test-dns-promises-resolve.js index a482cba60a2c14..ed9c95a010a36e 100644 --- a/test/internet/test-dns-promises-resolve.js +++ b/test/internet/test-dns-promises-resolve.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const dnsPromises = require('dns').promises; @@ -38,5 +38,5 @@ const dnsPromises = require('dns').promises; const result = await dnsPromises.resolve('example.org', rrtype); assert.ok(result !== undefined); assert.ok(result.length > 0); - })(); + })().then(common.mustCall()); } diff --git a/test/internet/test-dns-txt-sigsegv.js b/test/internet/test-dns-txt-sigsegv.js index 9f65b6ec24ffc0..eeebf28fc7761c 100644 --- a/test/internet/test-dns-txt-sigsegv.js +++ b/test/internet/test-dns-txt-sigsegv.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const dns = require('dns'); const dnsPromises = dns.promises; @@ -7,7 +7,7 @@ const dnsPromises = dns.promises; (async function() { const result = await dnsPromises.resolveTxt('www.microsoft.com'); assert.strictEqual(result.length, 0); -})(); +})().then(common.mustCall()); dns.resolveTxt('www.microsoft.com', function(err, records) { assert.strictEqual(err, null); diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index cb5069ce1c0288..363dc92446a5ef 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -748,4 +748,4 @@ dns.lookupService('0.0.0.0', 0, common.mustCall()); (async function() { await dnsPromises.lookup(addresses.INET6_HOST, 6); await dnsPromises.lookup(addresses.INET_HOST, {}); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index e06a5b3b236b7a..1c9234d644d174 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -40,7 +40,7 @@ const dnsPromises = dns.promises; res = await dnsPromises.lookup('::1'); assert.strictEqual(res.address, '::1'); assert.strictEqual(res.family, 6); -})(); +})().then(common.mustCall()); // Try resolution without hostname. dns.lookup(null, common.mustSucceed((result, addressType) => { @@ -89,5 +89,5 @@ if (!common.isWindows && !common.isIBMi) { (async function() { assert.ok(Array.isArray(await dnsPromises.reverse('127.0.0.1'))); - })(); + })().then(common.mustCall()); } diff --git a/test/parallel/test-child-process-spawn-args.js b/test/parallel/test-child-process-spawn-args.js index ef70fe844f9c12..ec56f409faf2a9 100644 --- a/test/parallel/test-child-process-spawn-args.js +++ b/test/parallel/test-child-process-spawn-args.js @@ -52,4 +52,4 @@ const expectedResult = tmpdir.path.trim().toLowerCase(); ); assert.deepStrictEqual([...new Set(results)], [expectedResult]); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-dns-lookup-promises.js b/test/parallel/test-dns-lookup-promises.js index 3e8e202c94c112..9dab377f6ac4eb 100644 --- a/test/parallel/test-dns-lookup-promises.js +++ b/test/parallel/test-dns-lookup-promises.js @@ -135,5 +135,5 @@ async function lookupallNegative() { lookupNegative(), lookupallPositive(), lookupallNegative() - ]).then(common.mustCall()); -})(); + ]); +})().then(common.mustCall()); diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index 53f24902378516..b089fd65787b95 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -110,7 +110,7 @@ assert.throws(() => { all: false }); assert.deepStrictEqual(res, { address: '127.0.0.1', family: 4 }); -})(); +})().then(common.mustCall()); dns.lookup(false, { hints: 0, diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index 6ad1f19a0a80ba..09fd02c3f148d6 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -274,7 +274,7 @@ dns.lookup('', { await dnsPromises.lookup('', { hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL }); -})(); +})().then(common.mustCall()); { const err = { @@ -447,7 +447,7 @@ assert.throws(() => { cases.shift(); nextCase(); })); - })(); + })().then(common.mustCall()); })); } diff --git a/test/parallel/test-fs-copyfile-respect-permissions.js b/test/parallel/test-fs-copyfile-respect-permissions.js index cb6774ef2abaee..cba99ed89984f4 100644 --- a/test/parallel/test-fs-copyfile-respect-permissions.js +++ b/test/parallel/test-fs-copyfile-respect-permissions.js @@ -49,7 +49,7 @@ function beforeEach() { const { source, dest, check } = beforeEach(); (async () => { await assert.rejects(fs.promises.copyFile(source, dest), check); - })(); + })().then(common.mustCall()); } // Test callback API. diff --git a/test/parallel/test-fs-read-empty-buffer.js b/test/parallel/test-fs-read-empty-buffer.js index 8ca08448182d4a..7ec5e5c186f5eb 100644 --- a/test/parallel/test-fs-read-empty-buffer.js +++ b/test/parallel/test-fs-read-empty-buffer.js @@ -38,4 +38,4 @@ assert.throws( 'Received Uint8Array(0) []' } ); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-fs-readdir-types.js b/test/parallel/test-fs-readdir-types.js index d841789f688390..9116a04f44ed70 100644 --- a/test/parallel/test-fs-readdir-types.js +++ b/test/parallel/test-fs-readdir-types.js @@ -76,7 +76,7 @@ fs.readdir(readdirDir, { withFileTypes: true }); assertDirents(dirents); -})(); +})().then(common.mustCall()); // Check for correct types when the binding returns unknowns const UNKNOWN = constants.UV_DIRENT_UNKNOWN; diff --git a/test/parallel/test-fs-readv-promises.js b/test/parallel/test-fs-readv-promises.js index e0536505c91291..1132417c9e27c4 100644 --- a/test/parallel/test-fs-readv-promises.js +++ b/test/parallel/test-fs-readv-promises.js @@ -1,6 +1,5 @@ 'use strict'; - -require('../common'); +const common = require('../common'); const assert = require('assert'); const path = require('path'); const fs = require('fs').promises; @@ -64,4 +63,4 @@ const allocateEmptyBuffers = (combinedLength) => { assert(Buffer.concat(bufferArr).equals(await fs.readFile(filename))); handle.close(); } -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-fs-rmdir-recursive.js b/test/parallel/test-fs-rmdir-recursive.js index e1f72a6bf2b1bd..7375eeacb07177 100644 --- a/test/parallel/test-fs-rmdir-recursive.js +++ b/test/parallel/test-fs-rmdir-recursive.js @@ -145,7 +145,7 @@ function removeAsync(dir) { // Attempted removal should fail now because the directory is gone. assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' }); -})(); +})().then(common.mustCall()); // Test input validation. { diff --git a/test/parallel/test-fs-stat-bigint.js b/test/parallel/test-fs-stat-bigint.js index 3ce12ecc076156..cffec39288de4a 100644 --- a/test/parallel/test-fs-stat-bigint.js +++ b/test/parallel/test-fs-stat-bigint.js @@ -212,4 +212,4 @@ if (!common.isWindows) { const allowableDelta = Math.ceil(Number(endTime - startTime) / 1e6); verifyStats(bigintStats, numStats, allowableDelta); await handle.close(); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-fs-writev-promises.js b/test/parallel/test-fs-writev-promises.js index ea349796cc6158..02da6799699946 100644 --- a/test/parallel/test-fs-writev-promises.js +++ b/test/parallel/test-fs-writev-promises.js @@ -1,6 +1,5 @@ 'use strict'; - -require('../common'); +const common = require('../common'); const assert = require('assert'); const path = require('path'); const fs = require('fs').promises; @@ -48,4 +47,4 @@ tmpdir.refresh(); assert(Buffer.concat(bufferArr).equals(await fs.readFile(filename))); handle.close(); } -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-inspect-publish-uid.js b/test/parallel/test-inspect-publish-uid.js index 58d651e97dc64e..2479a37a2d6901 100644 --- a/test/parallel/test-inspect-publish-uid.js +++ b/test/parallel/test-inspect-publish-uid.js @@ -10,7 +10,7 @@ const { spawnSync } = require('child_process'); await testArg('stderr'); await testArg('http'); await testArg('http,stderr'); -})(); +})().then(common.mustCall()); async function testArg(argValue) { console.log('Checks ' + argValue + '..'); diff --git a/test/parallel/test-internal-module-wrap.js b/test/parallel/test-internal-module-wrap.js index 09cccba76de004..520a83a3a47c0e 100644 --- a/test/parallel/test-internal-module-wrap.js +++ b/test/parallel/test-internal-module-wrap.js @@ -1,8 +1,6 @@ -'use strict'; - // Flags: --expose-internals - -require('../common'); +'use strict'; +const common = require('../common'); const assert = require('assert'); const { internalBinding } = require('internal/test/binding'); @@ -26,4 +24,4 @@ const bar = new ModuleWrap('bar', undefined, 'export const five = 5', 0, 0); assert.strictEqual(await foo.evaluate(-1, false), undefined); assert.strictEqual(foo.getNamespace().five, 5); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 257b66299ddffc..e900f3ce15579a 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -837,7 +837,7 @@ const tcpTests = [ socket.end(); } common.allowGlobals(...Object.values(global)); -})(); +})().then(common.mustCall()); function startTCPRepl() { let resolveSocket, resolveReplServer; diff --git a/test/parallel/test-util-inspect-namespace.js b/test/parallel/test-util-inspect-namespace.js index 00c952c05cffb2..951955fb7791e1 100644 --- a/test/parallel/test-util-inspect-namespace.js +++ b/test/parallel/test-util-inspect-namespace.js @@ -1,8 +1,6 @@ -'use strict'; - // Flags: --experimental-vm-modules - -require('../common'); +'use strict'; +const common = require('../common'); const assert = require('assert'); const { SourceTextModule } = require('vm'); @@ -20,4 +18,4 @@ const { inspect } = require('util'); inspect(m.namespace), '[Module: null prototype] { a: 1, b: 2 }' ); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-util-promisify.js b/test/parallel/test-util-promisify.js index cbbe8983fdf105..70125278d96164 100644 --- a/test/parallel/test-util-promisify.js +++ b/test/parallel/test-util-promisify.js @@ -131,7 +131,7 @@ const stat = promisify(fs.stat); (async () => { const value = await promisify(fn)(null, 42); assert.strictEqual(value, 42); - })(); + })().then(common.mustCall()); } { @@ -159,7 +159,7 @@ const stat = promisify(fs.stat); await fn(); await Promise.resolve(); return assert.strictEqual(stack, err.stack); - })(); + })().then(common.mustCall()); } { diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js index 48e65333d9a485..ead9bf54697b11 100644 --- a/test/parallel/test-util-types.js +++ b/test/parallel/test-util-types.js @@ -1,6 +1,6 @@ // Flags: --experimental-vm-modules --expose-internals 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const { types, inspect } = require('util'); const vm = require('vm'); @@ -280,4 +280,4 @@ for (const [ value, _method ] of [ await m.link(() => 0); await m.evaluate(); assert.ok(types.isModuleNamespaceObject(m.namespace)); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-vm-module-basic.js b/test/parallel/test-vm-module-basic.js index 7a669c8e05d741..dbb88e2a87741d 100644 --- a/test/parallel/test-vm-module-basic.js +++ b/test/parallel/test-vm-module-basic.js @@ -32,7 +32,7 @@ const util = require('util'); baz: 'bar', typeofProcess: 'undefined' }); -}()); +}().then(common.mustCall())); (async () => { const m = new SourceTextModule(` @@ -45,14 +45,14 @@ const util = require('util'); assert.strictEqual(global.vmResultTypeofProcess, '[object process]'); delete global.vmResultFoo; delete global.vmResultTypeofProcess; -})(); +})().then(common.mustCall()); (async () => { const m = new SourceTextModule('while (true) {}'); await m.link(common.mustNotCall()); await m.evaluate({ timeout: 500 }) .then(() => assert(false), () => {}); -})(); +})().then(common.mustCall()); // Check the generated identifier for each module (async () => { @@ -65,7 +65,7 @@ const util = require('util'); assert.strictEqual(m2.identifier, 'vm:module(1)'); const m3 = new SourceTextModule('3', { context: context2 }); assert.strictEqual(m3.identifier, 'vm:module(0)'); -})(); +})().then(common.mustCall()); // Check inspection of the instance { diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index fee243f101113b..2e9697ff4123f7 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -233,4 +233,4 @@ const finished = common.mustCall(); await checkInvalidOptionForEvaluate(); checkInvalidCachedData(); finished(); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-vm-module-import-meta.js b/test/parallel/test-vm-module-import-meta.js index baf6c5b37d1b3b..2972bf548b46e8 100644 --- a/test/parallel/test-vm-module-import-meta.js +++ b/test/parallel/test-vm-module-import-meta.js @@ -41,4 +41,4 @@ async function testInvalid() { (async () => { await testBasic(); await testInvalid(); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-vm-module-link.js b/test/parallel/test-vm-module-link.js index 99235cf1b6c033..39520bcf8e6891 100644 --- a/test/parallel/test-vm-module-link.js +++ b/test/parallel/test-vm-module-link.js @@ -132,4 +132,4 @@ const finished = common.mustCall(); await circular(); await circular2(); finished(); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-vm-module-reevaluate.js b/test/parallel/test-vm-module-reevaluate.js index 6208f140ffab88..e547390e0cf84f 100644 --- a/test/parallel/test-vm-module-reevaluate.js +++ b/test/parallel/test-vm-module-reevaluate.js @@ -48,4 +48,4 @@ const finished = common.mustCall(); } finished(); -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-vm-module-synthetic.js b/test/parallel/test-vm-module-synthetic.js index a3ca6630f7eab4..660c0c64ed8d5d 100644 --- a/test/parallel/test-vm-module-synthetic.js +++ b/test/parallel/test-vm-module-synthetic.js @@ -65,4 +65,4 @@ const assert = require('assert'); code: 'ERR_VM_MODULE_STATUS', }); } -})(); +})().then(common.mustCall()); diff --git a/test/parallel/test-zlib-empty-buffer.js b/test/parallel/test-zlib-empty-buffer.js index 3b52896d29965e..f225d72e649389 100644 --- a/test/parallel/test-zlib-empty-buffer.js +++ b/test/parallel/test-zlib-empty-buffer.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const zlib = require('zlib'); const { inspect, promisify } = require('util'); const assert = require('assert'); @@ -23,4 +23,4 @@ const emptyBuffer = Buffer.alloc(0); `Expected ${inspect(compressed)} to match ${inspect(decompressed)} ` + `to match for ${method}`); } -})(); +})().then(common.mustCall()); diff --git a/test/sequential/test-inspector-async-call-stack-abort.js b/test/sequential/test-inspector-async-call-stack-abort.js index ce2b43cdf02e82..a3d0944ce5ecbb 100644 --- a/test/sequential/test-inspector-async-call-stack-abort.js +++ b/test/sequential/test-inspector-async-call-stack-abort.js @@ -25,7 +25,7 @@ if (process.argv[2] === 'child') { await session.post('Debugger.setAsyncCallStackDepth', { maxDepth: 42 }); strictEqual(enabled, 1); throw new Error(eyecatcher); - })(); + })().finally(common.mustCall()); } else { const { spawnSync } = require('child_process'); const options = { encoding: 'utf8' }; diff --git a/test/wasi/test-wasi-stdio.js b/test/wasi/test-wasi-stdio.js index 4abe3c1ad8ae0d..d49fa67ce75a6a 100644 --- a/test/wasi/test-wasi-stdio.js +++ b/test/wasi/test-wasi-stdio.js @@ -1,6 +1,6 @@ // Flags: --experimental-wasi-unstable-preview1 --experimental-wasm-bigint 'use strict'; -require('../common'); +const common = require('../common'); const tmpdir = require('../common/tmpdir'); const { strictEqual } = require('assert'); const { closeSync, openSync, readFileSync, writeFileSync } = require('fs'); @@ -31,4 +31,4 @@ const importObject = { wasi_snapshot_preview1: wasi.wasiImport }; closeSync(stderr); strictEqual(readFileSync(stdoutFile, 'utf8').trim(), 'x'.repeat(31)); strictEqual(readFileSync(stderrFile, 'utf8').trim(), ''); -})(); +})().then(common.mustCall()); diff --git a/test/wasi/test-wasi-symlinks.js b/test/wasi/test-wasi-symlinks.js index d1ec796125cb53..b4f306916a9d9d 100644 --- a/test/wasi/test-wasi-symlinks.js +++ b/test/wasi/test-wasi-symlinks.js @@ -25,7 +25,7 @@ if (process.argv[2] === 'wasi-child') { const { instance } = await WebAssembly.instantiate(buffer, importObject); wasi.start(instance); - })(); + })().then(common.mustCall()); } else { if (!common.canCreateSymLink()) { common.skip('insufficient privileges'); diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js index b4c404e515cbb2..083cf1b17b75de 100644 --- a/test/wasi/test-wasi.js +++ b/test/wasi/test-wasi.js @@ -30,7 +30,7 @@ if (process.argv[2] === 'wasi-child') { const { instance } = await WebAssembly.instantiate(buffer, importObject); wasi.start(instance); - })(); + })().then(common.mustCall()); } else { const assert = require('assert'); const cp = require('child_process');