| 1 | import { TextDecoder, TextEncoder } from "util"; |
| 2 | |
| 3 | import { jest } from "@jest/globals"; |
| 4 | import fetch, { Request, Response } from "node-fetch"; |
| 5 | |
| 6 | if (process.env.DEBUG === "jest") { |
| 7 | jest.setTimeout(5 * 60 * 1000); |
| 8 | } |
| 9 | |
| 10 | const globalThis = global; |
| 11 | |
| 12 | globalThis.jest = jest; |
| 13 | |
| 14 | // https://github.com/mswjs/msw/issues/1576#issuecomment-1482643055 |
| 15 | globalThis.fetch = fetch; |
| 16 | globalThis.Request = Request; |
| 17 | globalThis.Response = Response; |
| 18 | globalThis.TextEncoder = TextEncoder; |
| 19 | globalThis.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); |