GeezerVison is showing github.com — test: ensure assertions are reachable in `test/es-module` · nodejs/node@759d693
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import '../common/index.mjs'; | | 2 | +// eslint-disable-next-line node-core/must-call-assert | 2 | 3 | import assert, { strict } from 'assert'; | | 4 | +// eslint-disable-next-line node-core/must-call-assert | 3 | 5 | import assertStrict from 'assert/strict'; | 4 | 6 |
| 5 | 7 | assert.strictEqual(strict, assertStrict); |
Collapse file Copy file name to clipboardExpand all lines: test/es-module/test-esm-assertionless-json-import.js +19-19Lines changed: 19 additions & 19 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // Flags: --experimental-loader ./test/fixtures/es-module-loaders/assertionless-json-import.mjs | 2 | 2 | 'use strict'; | 3 | 3 | const common = require('../common'); | 4 | | -const { strictEqual } = require('assert'); | | 4 | +const assert = require('assert'); | 5 | 5 |
| 6 | 6 | async function test() { | 7 | 7 | { | @@ -13,10 +13,10 @@ async function test() { | 13 | 13 | ), | 14 | 14 | ]); | 15 | 15 |
| 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); | 20 | 20 | } | 21 | 21 |
| 22 | 22 | { | @@ -28,10 +28,10 @@ async function test() { | 28 | 28 | ), | 29 | 29 | ]); | 30 | 30 |
| 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); | 35 | 35 | } | 36 | 36 |
| 37 | 37 | { | @@ -43,10 +43,10 @@ async function test() { | 43 | 43 | ), | 44 | 44 | ]); | 45 | 45 |
| 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); | 50 | 50 | } | 51 | 51 |
| 52 | 52 | { | @@ -58,10 +58,10 @@ async function test() { | 58 | 58 | ), | 59 | 59 | ]); | 60 | 60 |
| 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); | 65 | 65 | } | 66 | 66 |
| 67 | 67 | { | @@ -73,8 +73,8 @@ async function test() { | 73 | 73 | ), | 74 | 74 | ]); | 75 | 75 |
| 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); | 78 | 78 | } | 79 | 79 | } | 80 | 80 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/es-module/test-esm-cjs-named-error.mjs +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import '../common/index.mjs'; | 2 | | -import { rejects } from 'assert'; | | 2 | +import assert from 'assert'; | 3 | 3 |
| 4 | 4 | const fixtureBase = '../fixtures/es-modules/package-cjs-named-error'; | 5 | 5 |
| @@ -23,55 +23,55 @@ const expectedPackageHack = | 23 | 23 |
| 24 | 24 | const expectedBare = errTemplate('deep-fail', 'comeOn', '{ comeOn }'); | 25 | 25 |
| 26 | | -await rejects(async () => { | | 26 | +await assert.rejects(async () => { | 27 | 27 | await import(`${fixtureBase}/single-quote.mjs`); | 28 | 28 | }, { | 29 | 29 | name: 'SyntaxError', | 30 | 30 | message: expectedRelative | 31 | 31 | }, 'should support relative specifiers with single quotes'); | 32 | 32 |
| 33 | | -await rejects(async () => { | | 33 | +await assert.rejects(async () => { | 34 | 34 | await import(`${fixtureBase}/double-quote.mjs`); | 35 | 35 | }, { | 36 | 36 | name: 'SyntaxError', | 37 | 37 | message: expectedRelative | 38 | 38 | }, 'should support relative specifiers with double quotes'); | 39 | 39 |
| 40 | | -await rejects(async () => { | | 40 | +await assert.rejects(async () => { | 41 | 41 | await import(`${fixtureBase}/renamed-import.mjs`); | 42 | 42 | }, { | 43 | 43 | name: 'SyntaxError', | 44 | 44 | message: expectedRenamed | 45 | 45 | }, 'should correctly format named imports with renames'); | 46 | 46 |
| 47 | | -await rejects(async () => { | | 47 | +await assert.rejects(async () => { | 48 | 48 | await import(`${fixtureBase}/multi-line.mjs`); | 49 | 49 | }, { | 50 | 50 | name: 'SyntaxError', | 51 | 51 | message: expectedWithoutExample, | 52 | 52 | }, 'should correctly format named imports across multiple lines'); | 53 | 53 |
| 54 | | -await rejects(async () => { | | 54 | +await assert.rejects(async () => { | 55 | 55 | await import(`${fixtureBase}/json-hack.mjs`); | 56 | 56 | }, { | 57 | 57 | name: 'SyntaxError', | 58 | 58 | message: expectedPackageHack | 59 | 59 | }, 'should respect recursive package.json for module type'); | 60 | 60 |
| 61 | | -await rejects(async () => { | | 61 | +await assert.rejects(async () => { | 62 | 62 | await import(`${fixtureBase}/bare-import-single.mjs`); | 63 | 63 | }, { | 64 | 64 | name: 'SyntaxError', | 65 | 65 | message: expectedBare | 66 | 66 | }, 'should support bare specifiers with single quotes'); | 67 | 67 |
| 68 | | -await rejects(async () => { | | 68 | +await assert.rejects(async () => { | 69 | 69 | await import(`${fixtureBase}/bare-import-double.mjs`); | 70 | 70 | }, { | 71 | 71 | name: 'SyntaxError', | 72 | 72 | message: expectedBare | 73 | 73 | }, 'should support bare specifiers with double quotes'); | 74 | 74 |
| 75 | | -await rejects(async () => { | | 75 | +await assert.rejects(async () => { | 76 | 76 | await import(`${fixtureBase}/escaped-single-quote.mjs`); | 77 | 77 | }, /import pkg from '\.\/oh'no\.cjs'/, 'should support relative specifiers with escaped single quote'); |
Collapse file Copy file name to clipboard +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // Flags: --conditions=custom-condition -C another | 2 | 2 | import { mustCall } from '../common/index.mjs'; | 3 | | -import { strictEqual } from 'assert'; | | 3 | +import assert from 'assert'; | 4 | 4 | import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs'; | 5 | 5 | [requireFixture, importFixture].forEach((loadFixture) => { | 6 | 6 | loadFixture('pkgexports/condition') | 7 | 7 | .then(mustCall((actual) => { | 8 | | - strictEqual(actual.default, 'from custom condition'); | | 8 | + assert.strictEqual(actual.default, 'from custom condition'); | 9 | 9 | })); | 10 | 10 | }); |
Collapse file Copy file name to clipboard +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import '../common/index.mjs'; | 2 | | -import { strictEqual } from 'assert'; | | 2 | +import assert from 'assert'; | 3 | 3 |
| 4 | 4 | import asdf from | 5 | 5 | '../fixtures/es-modules/package-type-module/nested-default-type/module.js'; | 6 | 6 |
| 7 | | -strictEqual(asdf, 'asdf'); | | 7 | +assert.strictEqual(asdf, 'asdf'); |
|