From a51e9932dfe4a5b7b77bcc77ae10175cc48a7c95 Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Mon, 17 Jun 2019 18:22:52 +0800 Subject: [PATCH] build: fix `test:watch` task --- components/test.ts | 5 ++++- scripts/gulp/tasks/unit-test.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/test.ts b/components/test.ts index 7209ac8854a..ce11f140e27 100644 --- a/components/test.ts +++ b/components/test.ts @@ -32,6 +32,9 @@ if (tags) { // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // Filter specify file -const specFiles = context.keys().filter((path: string) => filterRegExp.test(path)); +const specFiles = context.keys().filter((path: string) => { + console.log(filterRegExp); + return filterRegExp.test(path); +}); // And load the modules. specFiles.map(context); diff --git a/scripts/gulp/tasks/unit-test.ts b/scripts/gulp/tasks/unit-test.ts index 2534296908c..e9ff55730da 100644 --- a/scripts/gulp/tasks/unit-test.ts +++ b/scripts/gulp/tasks/unit-test.ts @@ -3,11 +3,15 @@ import { execTask } from '../util/task-helpers'; task('test:watch', (done) => { const argv = require('minimist')(process.argv.slice(2)); + let tags = ''; + if (argv.tags && typeof argv.tags === 'string') { + tags = argv.tags; + } return execTask( 'ng', ['test', '--watch=true', '--code-coverage'], { - 'NG_TEST_TAGS': argv.tags || '' + 'NG_TEST_TAGS': tags } )(done); });