Files
hyperframes/packages/studio/src/test-setup.ts
T
renovate[bot]andJames eae4892ae8 chore(deps): update dependency vitest to v4 [security] (#3789)
* chore(deps): update dependency vitest to v4 [security]

* fix(test): preserve test behavior on Vitest 4

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: James <james.russo@heygen.com>
2026-09-10 13:55:52 -04:00

15 lines
652 B
TypeScript

if (typeof globalThis.CSS === "undefined") {
(globalThis as Record<string, unknown>).CSS = {};
}
if (typeof CSS.escape !== "function") {
CSS.escape = (value: string) => value.replace(/([^\w-])/g, "\\$1");
}
// happy-dom does not implement `window.confirm`. Vitest 3 let `vi.spyOn` invent
// a missing property; Vitest 4 refuses with "can only spy on a function", so the
// environment has to supply a real one for the guard tests to replace. Declining
// is the safe default: no test calls it without stubbing a return value first.
if (typeof globalThis.confirm !== "function") {
(globalThis as Record<string, unknown>).confirm = () => false;
}