angular/tools/testing/browser_zoneless_tests.init.ts
Andrew Scott 0c925af2dd test(router): This commit removes ZoneJS from the router tests (#61078)
There is nothing in the Router that requires ZoneJS and we do not need
`fakeAsync` as a mock clock. We can instead use any mock clock implementation
to speed up test execution.

This removes ZoneJS completely from the bundle of the Router tests.
ZoneJS causes the stacks to be unreadable when combined with the massive
rxjs stack in the router transition.

PR Close #61078
2025-05-05 08:55:01 -07:00

30 lines
931 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import 'reflect-metadata';
import '@angular/compiler'; // For JIT mode. Must be in front of any other @angular/* imports.
import {TestBed} from '@angular/core/testing';
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {NgModule, provideZonelessChangeDetection} from '@angular/core';
@NgModule({
providers: [provideZonelessChangeDetection()],
})
export class TestModule {}
TestBed.initTestEnvironment(
[BrowserTestingModule, NoopAnimationsModule, TestModule],
platformBrowserTesting(),
);
(window as any).isNode = false;
(window as any).isBrowser = true;
(window as any).global = window;