Elffuss BraidHub

kikocis/continue public

e31fcddb0dec · 867 BRawPermalink
1import { TextDecoder, TextEncoder } from "util";
2
3import { jest } from "@jest/globals";
4import fetch, { Request, Response } from "node-fetch";
5
6if (process.env.DEBUG === "jest") {
7 jest.setTimeout(5 * 60 * 1000);
8}
9
10const globalThis = global;
11
12globalThis.jest = jest;
13
14// https://github.com/mswjs/msw/issues/1576#issuecomment-1482643055
15globalThis.fetch = fetch;
16globalThis.Request = Request;
17globalThis.Response = Response;
18globalThis.TextEncoder = TextEncoder;
19globalThis.TextDecoder = TextDecoder;
20
21// TODO - currently causing tests to fail because sqlite is still running for some reason
22// const clearTestDirectory = () => {
23// if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) {
24// fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true });
25// }
26// };
27
28// globalThis.beforeAll(clearTestDirectory);
29// globalThis.afterAll(clearTestDirectory);