Skip to content

Commit

Permalink
fixup: switch test from substring to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer authored and GeoffreyBooth committed Mar 28, 2022
1 parent 49558a1 commit 61c0135
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/es-module/test-esm-experimental-warnings.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { mustCall } from '../common/index.mjs';
import { fileURL } from '../common/fixtures.mjs';
import { ok, strictEqual } from 'assert';
import { match, strictEqual } from 'assert';
import { spawn } from 'child_process';
import { execPath } from 'process';

// Verify experimental warnings are printed
for (
const [experiment, arg] of [
['Custom ESM Loaders', `--experimental-loader=${fileURL('es-module-loaders', 'hooks-custom.mjs')}`],
['Network Imports', '--experimental-network-imports'],
['Specifier Resolution', '--experimental-specifier-resolution=node'],
[/Custom ESM Loaders/, `--experimental-loader=${fileURL('es-module-loaders', 'hooks-custom.mjs')}`],
[/Network Imports/, '--experimental-network-imports'],
[/Specifier Resolution/, '--experimental-specifier-resolution=node'],
]
) {
const child = spawn(execPath, [
Expand All @@ -25,7 +25,7 @@ for (
child.on('close', mustCall((code, signal) => {
strictEqual(code, 0);
strictEqual(signal, null);
ok(stderr.includes('ExperimentalWarning:'));
ok(stderr.includes(experiment), new Error(`Expected warning to mention ${experiment}`));
match(stderr, /ExperimentalWarning:/);
match(stderr, experiment);
}));
}

0 comments on commit 61c0135

Please sign in to comment.