test(aio): move reflect-metadata polyfills to test.ts (#23234)

This resolves https://github.com/angular/angular-cli/issues/10333 and nicely cleans up the code.

PR Close #23234
This commit is contained in:
Igor Minar 2018-04-14 10:31:24 -07:00 committed by Jason Aden
parent 937f7cea37
commit 7493435911
3 changed files with 8 additions and 9 deletions

View File

@ -4,12 +4,10 @@
// The list of which env maps to which file can be found in `angular-cli.json`. // The list of which env maps to which file can be found in `angular-cli.json`.
// Reflect.metadata polyfill is only needed in the JIT/dev mode. // Reflect.metadata polyfill is only needed in the JIT, which use use only for tests
// // to make the unit tests work we load these polyfills in tests.ts instead
// In order to load these polyfills early enough (before app code), polyfill.ts imports this file to // import 'core-js/es6/reflect';
// to change the order in the final bundle. // import 'core-js/es7/reflect';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
export const environment = { export const environment = {

View File

@ -27,9 +27,6 @@
* and executed before the rest of the application files are executed. * and executed before the rest of the application files are executed.
*/ */
/** HACK: force import of environment.ts/environment.prod.ts to load env specific polyfills */
import './environments/environment';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/ /** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.

View File

@ -9,6 +9,10 @@ import {
declare const require: any; declare const require: any;
// Reflect.metadata polyfill is only needed in the JIT mode which we use only for unit tests
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(
BrowserDynamicTestingModule, BrowserDynamicTestingModule,