diff --git a/packages/angular_devkit/build_angular/test/hello-world-app/src/test.ts b/packages/angular_devkit/build_angular/test/hello-world-app/src/test.ts index 8a8bf0e3bc49..00b85b49756c 100644 --- a/packages/angular_devkit/build_angular/test/hello-world-app/src/test.ts +++ b/packages/angular_devkit/build_angular/test/hello-world-app/src/test.ts @@ -23,7 +23,11 @@ declare const require: { }; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting(), + { teardown: { destroyAfterEach: true }}, +); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. diff --git a/packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/src/test.ts b/packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/src/test.ts index 1b0764875268..179ce7251b5c 100644 --- a/packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/src/test.ts +++ b/packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/src/test.ts @@ -26,7 +26,8 @@ declare const require: { // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), + { teardown: { destroyAfterEach: true }}, ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/packages/schematics/angular/application/files/src/test.ts.template b/packages/schematics/angular/application/files/src/test.ts.template index 2042356408ff..b4dd6032fa21 100644 --- a/packages/schematics/angular/application/files/src/test.ts.template +++ b/packages/schematics/angular/application/files/src/test.ts.template @@ -17,8 +17,10 @@ declare const require: { // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), + { teardown: { destroyAfterEach: true }}, ); + // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. diff --git a/packages/schematics/angular/library/files/src/test.ts.template b/packages/schematics/angular/library/files/src/test.ts.template index 52e55168ebc6..b84c0c21c340 100644 --- a/packages/schematics/angular/library/files/src/test.ts.template +++ b/packages/schematics/angular/library/files/src/test.ts.template @@ -18,8 +18,10 @@ declare const require: { // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), + { teardown: { destroyAfterEach: true }}, ); + // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules.