-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
33 lines (31 loc) · 1.19 KB
/
Copy pathvitest.setup.ts
File metadata and controls
33 lines (31 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import "@testing-library/jest-dom/vitest";
import os from "node:os";
import path from "node:path";
// Isolate the file-backed brand-configuration store from the dev `data/`
// directory: without this, any test touching the brand resolver would read
// (or seed into) the developer's local brand-config.json. Individual tests
// may override BRAND_CONFIG_FILE to point at their own fixtures.
process.env.BRAND_CONFIG_FILE = path.join(
os.tmpdir(),
`lotto-brand-config-test-${process.pid}.json`,
);
// Same isolation for the file-backed brand-asset store.
process.env.BRAND_ASSETS_DIR = path.join(
os.tmpdir(),
`lotto-brand-assets-test-${process.pid}`,
);
// Polyfill IntersectionObserver for jsdom (required by motion/animate-ui icons)
if (typeof globalThis.IntersectionObserver === "undefined") {
globalThis.IntersectionObserver = class IntersectionObserver {
readonly root: Element | null = null;
readonly rootMargin: string = "0px";
readonly thresholds: ReadonlyArray<number> = [0];
constructor() {}
observe() {}
unobserve() {}
disconnect() {}
takeRecords(): IntersectionObserverEntry[] {
return [];
}
} as unknown as typeof globalThis.IntersectionObserver;
}