Files
hyperframes/packages/studio/src/test-setup.ts
T
Miguel Angel Simon Sierra 9fa11588e0 chore(studio): move Studio to Vite 8, plugin-react 6, Vitest 4
Bumps vite to 8.2.2, @vitejs/plugin-react to 6.1.1 and vitest to 4.1.11
together, since plugin-react 6 requires Vite 8. vite.config.ts needed no
change: none of the options it sets were dropped.

Three follow-ons the bump forced:

- Vitest 4 removed the poolOptions CLI flags in favour of a top-level
  --maxWorkers, so that is now the cap to pass when running the suite.
- Vite 6's type entry carried a reference to the Node types, which is how
  Studio's tsconfig got them without asking. Vite 8 declares @types/node as
  an optional peer instead, so Studio now depends on it and lists node in
  its types array, as every sibling package already does.
- Vitest 4's vi.fn() types as a callable-or-constructable union, so
  ReturnType<typeof vi.fn> no longer assigns to a plain callback prop. The
  affected annotations use Mock, whose default parameter is the old
  procedure-only shape.

Test count is unchanged: 4761 tests across 428 files.
2026-09-04 00:14:55 -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;
}