test.ts 870 Bytes
Newer Older
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
1 2
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

3
import { getTestBed } from '@angular/core/testing';
4 5
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import 'zone.js/dist/zone-testing';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
6 7 8 9 10 11

declare const require: any;

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
  BrowserDynamicTestingModule,
12
  platformBrowserDynamicTesting(),
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
13
);
14

15 16 17 18
/**
 * Then we find all the tests.
 * In case this stuff failes again without error, use this code to walk through all components step by step until the tests begin to fail:
 * @see https://github.com/angular/angular-cli/issues/10485
19
 *
20 21
 * Example: /(footer.*|header.*)\.spec\.ts$/
 */
22 23
const context = require.context('./', true, /\.spec\.ts$/);
context.keys().map(context);