fix(workbench): guard missing global navigator for node-env test files (Node 20)
This commit is contained in:
parent
9344f11415
commit
8ce60cc196
1 changed files with 9 additions and 0 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue