-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,37 @@ | ||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files | ||
|
||
// tslint:disable-next-line:no-import-side-effect | ||
import 'zone.js/dist/zone-testing'; | ||
|
||
import { getTestBed } from '@angular/core/testing'; | ||
import { | ||
BrowserDynamicTestingModule, | ||
platformBrowserDynamicTesting | ||
platformBrowserDynamicTesting, | ||
BrowserDynamicTestingModule | ||
} from '@angular/platform-browser-dynamic/testing'; | ||
|
||
// tslint:disable-next-line:no-any | ||
declare const __karma__: any; | ||
// tslint:disable-next-line:no-any | ||
declare const require: any; | ||
|
||
const tags = __karma__.config.args[0]; | ||
// First, initialize the Angular testing environment. | ||
getTestBed().initTestEnvironment( | ||
BrowserDynamicTestingModule, | ||
platformBrowserDynamicTesting() | ||
); | ||
|
||
let filterRegExp: RegExp; | ||
|
||
if (tags) { | ||
filterRegExp = new RegExp(`(${tags})\\.spec\\.ts$`); | ||
} else { | ||
filterRegExp = /\.spec\.ts$/; | ||
} | ||
|
||
// 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)); | ||
// And load the modules. | ||
context.keys().map(context); | ||
specFiles.map(context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { task } from 'gulp'; | ||
import { execTask } from '../util/task-helpers'; | ||
|
||
task('test:watch', (done) => { | ||
const argv = require('minimist')(process.argv.slice(2)); | ||
return execTask( | ||
'ng', | ||
['test', '--watch=true', '--code-coverage'], | ||
{ | ||
'NG_TEST_TAGS': argv.tags || '' | ||
} | ||
)(done); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters