mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): guard the jasmine hooks (#51394)
This commit fixes a regression introduced in #50063 Fixes #51382 PR Close #51394
This commit is contained in:
committed by
Andrew Kushnir
parent
4b0ef5acfb
commit
36f434e49d
@@ -16,12 +16,16 @@ import {resetFakeAsyncZone} from './fake_async';
|
||||
import {TestBedImpl} from './test_bed';
|
||||
|
||||
// Reset the test providers and the fake async zone before each test.
|
||||
beforeEach(getCleanupHook(false));
|
||||
// We keep a guard because somehow this file can make it into a bundle and be executed
|
||||
// beforeEach is only defined when executing the tests
|
||||
globalThis.beforeEach?.(getCleanupHook(false));
|
||||
|
||||
// We provide both a `beforeEach` and `afterEach`, because the updated behavior for
|
||||
// tearing down the module is supposed to run after the test so that we can associate
|
||||
// teardown errors with the correct test.
|
||||
afterEach(getCleanupHook(true));
|
||||
// We keep a guard because somehow this file can make it into a bundle and be executed
|
||||
// afterEach is only defined when executing the tests
|
||||
globalThis.afterEach?.(getCleanupHook(true));
|
||||
|
||||
function getCleanupHook(expectedTeardownValue: boolean) {
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user