Skip to content
Snippets Groups Projects
spec-bundle.js 1.44 KiB
Newer Older
Giuseppe Digilio's avatar
Giuseppe Digilio committed
/**
 * @author: @AngularClass
 */

/*
 * When testing with webpack and ES6, we have to do some extra
 * things to get testing to work right. Because we are gonna write tests
 * in ES6 too, we have to compile those as well. That's handled in
 * karma.conf.js with the karma-webpack plugin. This is the entry
 * file for webpack test. Just like webpack will create a bundle.js
 * file for our client, when we run test, it will compile and bundle them
 * all here! Crazy huh. So we need to do some setup
 */
Error.stackTraceLimit = Infinity;

lotte's avatar
lotte committed
require('core-js/es');
require('core-js/features/reflect');
Giuseppe Digilio's avatar
Giuseppe Digilio committed

// Typescript emit helpers polyfill
require('ts-helpers');

require('zone.js/dist/zone');
require('zone.js/dist/long-stack-trace-zone');
require('zone.js/dist/proxy'); // since zone.js 0.6.15
require('zone.js/dist/sync-test');
require('zone.js/dist/jasmine-patch'); // put here since zone.js 0.6.14
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');

// RxJS
lotte's avatar
lotte committed
require('rxjs');
Giuseppe Digilio's avatar
Giuseppe Digilio committed

var testing = require('@angular/core/testing');
var browser = require('@angular/platform-browser-dynamic/testing');

testing.TestBed.initTestEnvironment(
  browser.BrowserDynamicTestingModule,
  browser.platformBrowserDynamicTesting()
);

var tests = require.context('./src', true, /\.spec\.ts$/);

tests.keys().forEach(tests);

// includes all modules into test coverage
const modules = require.context('./src/app', true, /\.module\.ts$/);
Giuseppe Digilio's avatar
Giuseppe Digilio committed

modules.keys().forEach(modules);