Skip to content

Commit 2c4ebe0

Browse files
committed
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 <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent da95dd7 commit 2c4ebe0

35 files changed

+55
-61
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+
constcommon=require('../common');
44
constassert=require('assert');
55

66
constfile='../fixtures/syntax/bad_syntax.mjs';
@@ -23,4 +23,4 @@ let error;
2323
returntrue;
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
importassertfrom'assert';
44

55
constdirname=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(awaitimport.meta.resolve('../fixtures/'),fixtures);
2222
assert.strictEqual(awaitimport.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+
constcommon=require('../common');
33
constassert=require('assert');
44

55
constdnsPromises=require('dns').promises;
@@ -38,5 +38,5 @@ const dnsPromises = require('dns').promises;
3838
constresult=awaitdnsPromises.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+
constcommon=require('../common');
33
constassert=require('assert');
44
constdns=require('dns');
55
constdnsPromises=dns.promises;
66

77
(asyncfunction(){
88
constresult=awaitdnsPromises.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
@@ -708,4 +708,4 @@ dns.lookupService('0.0.0.0', 0, common.mustCall());
708708
(asyncfunction(){
709709
awaitdnsPromises.lookup(addresses.INET6_HOST,6);
710710
awaitdnsPromises.lookup(addresses.INET_HOST,{});
711-
})();
711+
})().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=awaitdnsPromises.lookup('::1');
4141
assert.strictEqual(res.address,'::1');
4242
assert.strictEqual(res.family,6);
43-
})();
43+
})().then(common.mustCall());
4444

4545
// Try resolution without callback
4646

@@ -94,5 +94,5 @@ if (!common.isWindows && !common.isIBMi){
9494

9595
(asyncfunction(){
9696
assert.ok(Array.isArray(awaitdnsPromises.reverse('127.0.0.1')));
97-
})();
97+
})().then(common.mustCall());
9898
}

‎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([...newSet(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
@@ -109,7 +109,7 @@ assert.throws(() =>{
109109
all: false
110110
});
111111
assert.deepStrictEqual(res,{address: '127.0.0.1',family: 4});
112-
})();
112+
})().then(common.mustCall());
113113

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

‎test/parallel/test-dns-setservers-type-check.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const promiseResolver = new dns.promises.Resolver();
9595
// This should not throw any error.
9696
(async()=>{
9797
setServers(['127.0.0.1']);
98-
})();
98+
})().then(common.mustCall());
9999

100100
[
101101
[null],

0 commit comments

Comments
(0)