-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_globals.ts
More file actions
29 lines (25 loc) · 830 Bytes
/
Copy pathtest_globals.ts
File metadata and controls
29 lines (25 loc) · 830 Bytes
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
// Setup JSDOM
import { JSDOM } from "jsdom";
const doc = new JSDOM("");
globalThis.document = doc.window.document;
globalThis.HTMLIFrameElement = doc.window.HTMLIFrameElement;
// Setup expect with jest-dom matchers
import type { TestingLibraryMatchers } from "https://esm.sh/@types/testing-library__jest-dom/matchers";
declare module "https://deno.land/x/expect@v0.2.10/mod.ts" {
export interface Expected<R = void, T = {}>
extends TestingLibraryMatchers<string, R> {}
}
import {
expect,
addMatchers,
Expected,
} from "https://deno.land/x/expect@v0.2.10/mod.ts";
import matchers from "https://esm.sh/@testing-library/jest-dom@5.16.5/matchers";
declare global {
let expect: (value: any) => Expected;
interface Window {
expect: (value: any) => Expected;
}
}
addMatchers(matchers);
window.expect = expect;