Skip to content

Commit b496f7f

Browse files
fixup: switch test from substring to regex
1 parent c1f74b1 commit b496f7f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/es-module/test-esm-experimental-warnings.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { mustCall } from '../common/index.mjs';
22
import { fileURL } from '../common/fixtures.mjs';
3-
import { ok, strictEqual } from 'assert';
3+
import { match, strictEqual } from 'assert';
44
import { spawn } from 'child_process';
55
import { execPath } from 'process';
66

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

0 commit comments

Comments
 (0)