Skip to content

Commit

Permalink
test: use assert.match() instead of assert(regex.test())
Browse files Browse the repository at this point in the history
PR-URL: nodejs#42803
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
  • Loading branch information
aduh95 authored Apr 21, 2022
1 parent a2d86f6 commit 1aab13c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions test/parallel/test-runner-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const testFixtures = fixtures.path('test-runner');
assert.strictEqual(child.status, 1);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stdout.toString(), '');
assert(/^Could not find/.test(child.stderr.toString()));
assert.match(child.stderr.toString(), /^Could not find/);
}

{
Expand All @@ -27,11 +27,11 @@ const testFixtures = fixtures.path('test-runner');
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();
assert(/ok 1 - .+index\.test\.js/.test(stdout));
assert(/not ok 2 - .+random\.test\.mjs/.test(stdout));
assert(/not ok 1 - this should fail/.test(stdout));
assert(/ok 3 - .+subdir.+subdir_test\.js/.test(stdout));
assert(/ok 4 - .+random\.cjs/.test(stdout));
assert.match(stdout, /ok 1 - .+index\.test\.js/);
assert.match(stdout, /not ok 2 - .+random\.test\.mjs/);
assert.match(stdout, /not ok 1 - this should fail/);
assert.match(stdout, /ok 3 - .+subdir.+subdir_test\.js/);
assert.match(stdout, /ok 4 - .+random\.cjs/);
}

{
Expand All @@ -43,11 +43,11 @@ const testFixtures = fixtures.path('test-runner');
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();
assert(/not ok 1 - .+index\.js/.test(stdout));
assert(/ok 2 - .+index\.test\.js/.test(stdout));
assert(/not ok 3 - .+random\.test\.mjs/.test(stdout));
assert(/not ok 1 - this should fail/.test(stdout));
assert(/ok 4 - .+subdir.+subdir_test\.js/.test(stdout));
assert.match(stdout, /not ok 1 - .+index\.js/);
assert.match(stdout, /ok 2 - .+index\.test\.js/);
assert.match(stdout, /not ok 3 - .+random\.test\.mjs/);
assert.match(stdout, /not ok 1 - this should fail/);
assert.match(stdout, /ok 4 - .+subdir.+subdir_test\.js/);
}

{
Expand All @@ -59,7 +59,7 @@ const testFixtures = fixtures.path('test-runner');
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();
assert(/not ok 1 - .+test-nm\.js/.test(stdout));
assert.match(stdout, /not ok 1 - .+test-nm\.js/);
}

{
Expand All @@ -72,11 +72,11 @@ const testFixtures = fixtures.path('test-runner');
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();
assert(/ok 1 - .+index\.test\.js/.test(stdout));
assert(/not ok 2 - .+random\.test\.mjs/.test(stdout));
assert(/not ok 1 - this should fail/.test(stdout));
assert(/ok 3 - .+subdir.+subdir_test\.js/.test(stdout));
assert(/ok 4 - .+random\.cjs/.test(stdout));
assert.match(stdout, /ok 1 - .+index\.test\.js/);
assert.match(stdout, /not ok 2 - .+random\.test\.mjs/);
assert.match(stdout, /not ok 1 - this should fail/);
assert.match(stdout, /ok 3 - .+subdir.+subdir_test\.js/);
assert.match(stdout, /ok 4 - .+random\.cjs/);
}

{
Expand All @@ -102,6 +102,6 @@ const testFixtures = fixtures.path('test-runner');
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stdout.toString(), '');
const stderr = child.stderr.toString();
assert(/--test/.test(stderr));
assert.match(stderr, /--test/);
});
}

0 comments on commit 1aab13c

Please sign in to comment.