Commit 79e52cc
committed
fix(@angular/build): ensure TestBed cleanup hooks are always registered
This commit moves the `beforeEach` and `afterEach` hook registrations for TestBed cleanup to be outside the global setup guard.
In environments where test isolation is not strictly enforced (when `isolate: false`), the setup file can be executed multiple times in different contexts. The global guard would previously prevent the hooks from being re-registered, leading to inconsistent test behavior and potential state leakage between tests.
This change ensures the cleanup hooks are always registered, improving the reliability and predictability of tests across all execution environments.1 parent 9b5a452 commit 79e52cc
File tree
1 file changed
+6
-4
lines changed- packages/angular/build/src/builders/unit-test/runners/vitest
1 file changed
+6
-4
lines changedLines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
0 commit comments