Skip to content

Commit de9c8cb

Browse files
committed
test: ensure assertions are reachable in test/es-module
PR-URL: #60501 Reviewed-By: Chemi Atlow <[email protected]>
1 parent 75bc40f commit de9c8cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+626
-620
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import'../common/index.mjs';
2+
// eslint-disable-next-line node-core/must-call-assert
23
importassert,{strict}from'assert';
4+
// eslint-disable-next-line node-core/must-call-assert
35
importassertStrictfrom'assert/strict';
46

57
assert.strictEqual(strict,assertStrict);

‎test/es-module/test-esm-assertionless-json-import.js‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Flags: --experimental-loader ./test/fixtures/es-module-loaders/assertionless-json-import.mjs
22
'use strict';
33
constcommon=require('../common');
4-
const{ strictEqual }=require('assert');
4+
constassert=require('assert');
55

66
asyncfunctiontest(){
77
{
@@ -13,10 +13,10 @@ async function test(){
1313
),
1414
]);
1515

16-
strictEqual(secret0.default.ofLife,42);
17-
strictEqual(secret1.default.ofLife,42);
18-
strictEqual(secret0.default,secret1.default);
19-
strictEqual(secret0,secret1);
16+
assert.strictEqual(secret0.default.ofLife,42);
17+
assert.strictEqual(secret1.default.ofLife,42);
18+
assert.strictEqual(secret0.default,secret1.default);
19+
assert.strictEqual(secret0,secret1);
2020
}
2121

2222
{
@@ -28,10 +28,10 @@ async function test(){
2828
),
2929
]);
3030

31-
strictEqual(secret0.default.ofLife,42);
32-
strictEqual(secret1.default.ofLife,42);
33-
strictEqual(secret0.default,secret1.default);
34-
strictEqual(secret0,secret1);
31+
assert.strictEqual(secret0.default.ofLife,42);
32+
assert.strictEqual(secret1.default.ofLife,42);
33+
assert.strictEqual(secret0.default,secret1.default);
34+
assert.strictEqual(secret0,secret1);
3535
}
3636

3737
{
@@ -43,10 +43,10 @@ async function test(){
4343
),
4444
]);
4545

46-
strictEqual(secret0.default.ofLife,42);
47-
strictEqual(secret1.default.ofLife,42);
48-
strictEqual(secret0.default,secret1.default);
49-
strictEqual(secret0,secret1);
46+
assert.strictEqual(secret0.default.ofLife,42);
47+
assert.strictEqual(secret1.default.ofLife,42);
48+
assert.strictEqual(secret0.default,secret1.default);
49+
assert.strictEqual(secret0,secret1);
5050
}
5151

5252
{
@@ -58,10 +58,10 @@ async function test(){
5858
),
5959
]);
6060

61-
strictEqual(secret0.default.ofLife,42);
62-
strictEqual(secret1.default.ofLife,42);
63-
strictEqual(secret0.default,secret1.default);
64-
strictEqual(secret0,secret1);
61+
assert.strictEqual(secret0.default.ofLife,42);
62+
assert.strictEqual(secret1.default.ofLife,42);
63+
assert.strictEqual(secret0.default,secret1.default);
64+
assert.strictEqual(secret0,secret1);
6565
}
6666

6767
{
@@ -73,8 +73,8 @@ async function test(){
7373
),
7474
]);
7575

76-
strictEqual(secret0.default.ofLife,42);
77-
strictEqual(secret1.default.ofLife,42);
76+
assert.strictEqual(secret0.default.ofLife,42);
77+
assert.strictEqual(secret1.default.ofLife,42);
7878
}
7979
}
8080

‎test/es-module/test-esm-cjs-named-error.mjs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import'../common/index.mjs';
2-
import{rejects}from'assert';
2+
importassertfrom'assert';
33

44
constfixtureBase='../fixtures/es-modules/package-cjs-named-error';
55

@@ -23,55 +23,55 @@ const expectedPackageHack =
2323

2424
constexpectedBare=errTemplate('deep-fail','comeOn','{comeOn }');
2525

26-
awaitrejects(async()=>{
26+
awaitassert.rejects(async()=>{
2727
awaitimport(`${fixtureBase}/single-quote.mjs`);
2828
},{
2929
name: 'SyntaxError',
3030
message: expectedRelative
3131
},'should support relative specifiers with single quotes');
3232

33-
awaitrejects(async()=>{
33+
awaitassert.rejects(async()=>{
3434
awaitimport(`${fixtureBase}/double-quote.mjs`);
3535
},{
3636
name: 'SyntaxError',
3737
message: expectedRelative
3838
},'should support relative specifiers with double quotes');
3939

40-
awaitrejects(async()=>{
40+
awaitassert.rejects(async()=>{
4141
awaitimport(`${fixtureBase}/renamed-import.mjs`);
4242
},{
4343
name: 'SyntaxError',
4444
message: expectedRenamed
4545
},'should correctly format named imports with renames');
4646

47-
awaitrejects(async()=>{
47+
awaitassert.rejects(async()=>{
4848
awaitimport(`${fixtureBase}/multi-line.mjs`);
4949
},{
5050
name: 'SyntaxError',
5151
message: expectedWithoutExample,
5252
},'should correctly format named imports across multiple lines');
5353

54-
awaitrejects(async()=>{
54+
awaitassert.rejects(async()=>{
5555
awaitimport(`${fixtureBase}/json-hack.mjs`);
5656
},{
5757
name: 'SyntaxError',
5858
message: expectedPackageHack
5959
},'should respect recursive package.json for module type');
6060

61-
awaitrejects(async()=>{
61+
awaitassert.rejects(async()=>{
6262
awaitimport(`${fixtureBase}/bare-import-single.mjs`);
6363
},{
6464
name: 'SyntaxError',
6565
message: expectedBare
6666
},'should support bare specifiers with single quotes');
6767

68-
awaitrejects(async()=>{
68+
awaitassert.rejects(async()=>{
6969
awaitimport(`${fixtureBase}/bare-import-double.mjs`);
7070
},{
7171
name: 'SyntaxError',
7272
message: expectedBare
7373
},'should support bare specifiers with double quotes');
7474

75-
awaitrejects(async()=>{
75+
awaitassert.rejects(async()=>{
7676
awaitimport(`${fixtureBase}/escaped-single-quote.mjs`);
7777
},/importpkgfrom'\.\/oh'no\.cjs'/,'should support relative specifiers with escaped single quote');
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Flags: --conditions=custom-condition -C another
22
import{mustCall}from'../common/index.mjs';
3-
import{strictEqual}from'assert';
3+
importassertfrom'assert';
44
import{requireFixture,importFixture}from'../fixtures/pkgexports.mjs';
55
[requireFixture,importFixture].forEach((loadFixture)=>{
66
loadFixture('pkgexports/condition')
77
.then(mustCall((actual)=>{
8-
strictEqual(actual.default,'from custom condition');
8+
assert.strictEqual(actual.default,'from custom condition');
99
}));
1010
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import'../common/index.mjs';
2-
import{strictEqual}from'assert';
2+
importassertfrom'assert';
33

44
importasdffrom
55
'../fixtures/es-modules/package-type-module/nested-default-type/module.js';
66

7-
strictEqual(asdf,'asdf');
7+
assert.strictEqual(asdf,'asdf');

0 commit comments

Comments
(0)