Skip to content

Commit

Permalink
build: add support for specifying a custom glob with the test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Jan 13, 2020
1 parent 4883037 commit 2dc0401
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tools/test-globber.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint "global-require": "off", "import/no-dynamic-require": "off" */
import minimist from 'minimist';
import * as path from 'path';
import Glob from 'glob';
import glob from 'glob';

import { getPackageInfoSync } from './utils';

Expand All @@ -19,7 +19,15 @@ const testFiles: string[] = [];
for (const p of packages) {
if (argv.match && !p.name.includes(argv.match)) continue;

testFiles.push(...Glob.sync(path.resolve(p.path, 'test', '**', `*_spec${isFast ? '' : '*'}.ts`)));
let specGlob: string;

if (argv.glob) {
specGlob = path.resolve(p.path, argv.glob);
} else {
specGlob = path.resolve(p.path, 'test', '**', `*_spec${isFast ? '' : '*'}.ts`);
}

testFiles.push(...glob.sync(specGlob));
}

for (const f of testFiles) {
Expand Down

0 comments on commit 2dc0401

Please sign in to comment.