Skip to content

Commit 759d693

Browse files
committed
test: ensure assertions are reachable in test/es-module
PR-URL: #60501 Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent 6aaf18c commit 759d693

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
import assert, { strict } from 'assert';
4+
// eslint-disable-next-line node-core/must-call-assert
35
import assertStrict from '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
const common = require('../common');
4-
const { strictEqual } = require('assert');
4+
const assert = require('assert');
55

66
async function test() {
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+
import assert from 'assert';
33

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

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

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

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

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

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

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

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

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

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

75-
await rejects(async () => {
75+
await assert.rejects(async () => {
7676
await import(`${fixtureBase}/escaped-single-quote.mjs`);
7777
}, /import pkg from '\.\/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+
import assert from '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+
import assert from 'assert';
33

44
import asdf from
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)