node/test/parallel/test-runner-test-filter.js
Colin Ihrig adaf602405
test_runner: add initial CLI runner
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: https://github.com/nodejs/node/pull/42658
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-04-15 18:37:28 +01:00

43 lines
786 B
JavaScript

// Flags: --expose-internals
'use strict';
require('../common');
const assert = require('assert');
const { doesPathMatchFilter } = require('internal/test_runner/utils');
// Paths expected to match
[
'test.js',
'test.cjs',
'test.mjs',
'test-foo.js',
'test-foo.cjs',
'test-foo.mjs',
'foo.test.js',
'foo.test.cjs',
'foo.test.mjs',
'foo-test.js',
'foo-test.cjs',
'foo-test.mjs',
'foo_test.js',
'foo_test.cjs',
'foo_test.mjs',
].forEach((p) => {
assert.strictEqual(doesPathMatchFilter(p), true);
});
// Paths expected not to match
[
'test',
'test.djs',
'test.cs',
'test.mj',
'foo.js',
'test-foo.sj',
'test.foo.js',
'test_foo.js',
'testfoo.js',
'foo-test1.mjs',
].forEach((p) => {
assert.strictEqual(doesPathMatchFilter(p), false);
});