Skip to content

Commit 89ee6ab

Browse files
addaleaxtargos
authored andcommitted
test: use .then(common.mustCall()) for all async IIFEs
This makes sure that all async functions finish as expected. PR-URL: #34363 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 55fc206 commit 89ee6ab

34 files changed

+54
-60
lines changed

test/es-module/test-esm-error-cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
44
const assert = require('assert');
55

66
const file = '../fixtures/syntax/bad_syntax.mjs';
@@ -23,4 +23,4 @@ let error;
2323
return true;
2424
}
2525
);
26-
})();
26+
})().then(common.mustCall());

test/es-module/test-esm-import-meta-resolve.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Flags: --experimental-import-meta-resolve
2-
import '../common/index.mjs';
2+
import { mustCall } from '../common/index.mjs';
33
import assert from 'assert';
44

55
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) +
2121
assert.strictEqual(await import.meta.resolve('../fixtures/'), fixtures);
2222
assert.strictEqual(await import.meta.resolve('baz/', fixtures),
2323
fixtures + 'node_modules/baz/');
24-
})();
24+
})().then(mustCall());

test/internet/test-dns-promises-resolve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44

55
const dnsPromises = require('dns').promises;
@@ -38,5 +38,5 @@ const dnsPromises = require('dns').promises;
3838
const result = await dnsPromises.resolve('example.org', rrtype);
3939
assert.ok(result !== undefined);
4040
assert.ok(result.length > 0);
41-
})();
41+
})().then(common.mustCall());
4242
}

test/internet/test-dns-txt-sigsegv.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44
const dns = require('dns');
55
const dnsPromises = dns.promises;
66

77
(async function() {
88
const result = await dnsPromises.resolveTxt('www.microsoft.com');
99
assert.strictEqual(result.length, 0);
10-
})();
10+
})().then(common.mustCall());
1111

1212
dns.resolveTxt('www.microsoft.com', function(err, records) {
1313
assert.strictEqual(err, null);

test/internet/test-dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,4 +748,4 @@ dns.lookupService('0.0.0.0', 0, common.mustCall());
748748
(async function() {
749749
await dnsPromises.lookup(addresses.INET6_HOST, 6);
750750
await dnsPromises.lookup(addresses.INET_HOST, {});
751-
})();
751+
})().then(common.mustCall());

test/parallel/test-c-ares.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const dnsPromises = dns.promises;
4040
res = await dnsPromises.lookup('::1');
4141
assert.strictEqual(res.address, '::1');
4242
assert.strictEqual(res.family, 6);
43-
})();
43+
})().then(common.mustCall());
4444

4545
// Try resolution without hostname.
4646
dns.lookup(null, common.mustSucceed((result, addressType) => {
@@ -89,5 +89,5 @@ if (!common.isWindows && !common.isIBMi) {
8989

9090
(async function() {
9191
assert.ok(Array.isArray(await dnsPromises.reverse('127.0.0.1')));
92-
})();
92+
})().then(common.mustCall());
9393
}

test/parallel/test-child-process-spawn-args.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ const expectedResult = tmpdir.path.trim().toLowerCase();
5252
);
5353

5454
assert.deepStrictEqual([...new Set(results)], [expectedResult]);
55-
})();
55+
})().then(common.mustCall());

test/parallel/test-dns-lookup-promises.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,5 @@ async function lookupallNegative() {
135135
lookupNegative(),
136136
lookupallPositive(),
137137
lookupallNegative()
138-
]).then(common.mustCall());
139-
})();
138+
]);
139+
})().then(common.mustCall());

test/parallel/test-dns-lookup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ assert.throws(() => {
110110
all: false
111111
});
112112
assert.deepStrictEqual(res, { address: '127.0.0.1', family: 4 });
113-
})();
113+
})().then(common.mustCall());
114114

115115
dns.lookup(false, {
116116
hints: 0,

test/parallel/test-dns.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ dns.lookup('', {
274274
await dnsPromises.lookup('', {
275275
hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL
276276
});
277-
})();
277+
})().then(common.mustCall());
278278

279279
{
280280
const err = {
@@ -447,7 +447,7 @@ assert.throws(() => {
447447
cases.shift();
448448
nextCase();
449449
}));
450-
})();
450+
})().then(common.mustCall());
451451

452452
}));
453453
}

0 commit comments

Comments
 (0)