mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-07-09 16:09:13 +00:00
fix(SKY-11404): flush Radix focus-scope unmount timer in vitest teardown (#6795)
This commit is contained in:
parent
64ac33305c
commit
a75b83a319
1 changed files with 11 additions and 0 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { cleanup } from "@testing-library/react";
|
||||||
|
import { afterEach } from "vitest";
|
||||||
|
|
||||||
type StorageRecord = Record<string, string>;
|
type StorageRecord = Record<string, string>;
|
||||||
|
|
||||||
const createMemoryStorage = (): Storage => {
|
const createMemoryStorage = (): Storage => {
|
||||||
|
|
@ -58,3 +61,11 @@ if (typeof window !== "undefined") {
|
||||||
value: window.CustomEvent,
|
value: window.CustomEvent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Radix FocusScope schedules a setTimeout(..., 0) on unmount that dispatches a
|
||||||
|
// CustomEvent. Flush it within the test's realm (cleanup then one macrotask) so
|
||||||
|
// it can't fire during teardown against a swapped realm and red the run.
|
||||||
|
afterEach(async () => {
|
||||||
|
cleanup();
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue