Environment
- React: 19.3.1
- Zone.js: 0.16.3
- Runtime: Bun 1.4.4
Reproduction
import "zone.js";
import { act } from "react";
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
await act(async () => {});
Running this prints:
You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);
The act result is awaited, and the callback is empty. The warning also reproduces with React Testing Library's await act(async () => cleanup()) teardown. It does not reproduce when the same thenable is adopted by calling its then method directly:
await new Promise((resolve, reject) => act(async () => {}).then(resolve, reject));
Expected behavior
An awaited act call should not emit the unawaited-call warning when Zone.js is present.
Impact
Tests that use Zone.js for asynchronous context propagation receive a false positive from React's act warning, making genuine unawaited act calls harder to identify.