summaryrefslogtreecommitdiff
path: root/test/parallel/test-runner-test-filter.js
blob: b6afba22a2e814ef6d16e59e458aaaab091655a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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);
});