fix(workbench): guard missing global navigator for node-env test files (Node 20)

This commit is contained in:
Shay 2026-06-12 13:26:30 -07:00
parent 9344f11415
commit 8ce60cc196

View file

@ -1,5 +1,14 @@
import "@testing-library/jest-dom/vitest";
// Node-environment test files (doctrine/*) have no global navigator on
// Node 20 (Node >=21 added one — which is why this only fails in CI).
if (typeof globalThis.navigator === "undefined") {
Object.defineProperty(globalThis, "navigator", {
configurable: true,
value: {},
});
}
Object.defineProperty(navigator, "clipboard", {
configurable: true,
value: {