From 61c0135737d1d3369571c097fc6e8e946e4af631 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Sat, 12 Mar 2022 22:30:31 +0100 Subject: [PATCH] fixup: switch test from substring to regex --- test/es-module/test-esm-experimental-warnings.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/es-module/test-esm-experimental-warnings.mjs b/test/es-module/test-esm-experimental-warnings.mjs index 2b8cf9216d4017..30e481f4b30e7f 100644 --- a/test/es-module/test-esm-experimental-warnings.mjs +++ b/test/es-module/test-esm-experimental-warnings.mjs @@ -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, [ @@ -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); })); }