From 6a13ea47e71d6a666327b153be067f630dd7a680 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Thu, 15 May 2025 13:17:18 -0400 Subject: [PATCH] fix(@angular/build): use global unit-test hooks during TestBed init To provide improved Zone.js support with the experimental `unit-test` builder using the `vitest` runner, the TestBed initialization now uses the global `beforeEach`/`afterEach` test hooks. The global hooks can be patched by Zone.js. The vitest globals are always available when using the `unit-test` builder. --- packages/angular/build/src/builders/unit-test/builder.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/angular/build/src/builders/unit-test/builder.ts b/packages/angular/build/src/builders/unit-test/builder.ts index 4a0808f58115..509b6de0e559 100644 --- a/packages/angular/build/src/builders/unit-test/builder.ts +++ b/packages/angular/build/src/builders/unit-test/builder.ts @@ -145,7 +145,6 @@ export async function* execute( `import { NgModule } from '@angular/core';`, `import { getTestBed, ɵgetCleanupHook as getCleanupHook } from '@angular/core/testing';`, `import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';`, - `import { beforeEach, afterEach } from 'vitest';`, '', normalizedOptions.providersFile ? `import providers from './${path