Skip to content

Commit 94f5a4b

Browse files
atscottthePunderWoman
authored andcommitted
fix(core): Testing should not throw when Zone does not patch test FW APIs (#61376)
This prevents `core/testing` from throwing an error if ZoneJS is present but does not patch the test FW APIs such that `fakeAsync` works automatically. For example, there is currently no patching of the vitest APIs, so if you try to use Vitest with Zone on the page, it will throw. PR Close #61376
1 parent f1b51ce commit 94f5a4b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/core/testing/src/fake_async.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function resetFakeAsyncZone(): void {
2525
}
2626

2727
export function resetFakeAsyncZoneIfExists(): void {
28-
if (fakeAsyncTestModule) {
28+
if (fakeAsyncTestModule && (Zone as any)['ProxyZoneSpec']?.isLoaded()) {
2929
fakeAsyncTestModule.resetFakeAsyncZone();
3030
}
3131
}

0 commit comments

Comments
 (0)