1
0
Fork 0
mirror of synced 2024-09-21 03:43:21 +12:00
budibase/packages/backend-core/tests/jestSetup.ts

37 lines
793 B
TypeScript
Raw Normal View History

import "./core/logging"
2022-05-04 09:58:19 +12:00
import env from "../src/environment"
import { cleanup } from "../src/timers"
import { mocks, testContainerUtils } from "./core/utilities"
import nock from "nock"
// mock all dates to 2020-01-01T00:00:00.000Z
// use tk.reset() to use real dates in individual tests
import tk from "timekeeper"
2023-11-21 09:52:29 +13:00
nock.disableNetConnect()
nock.enableNetConnect(host => {
return (
host.includes("localhost") ||
host.includes("127.0.0.1") ||
host.includes("::1")
)
})
tk.freeze(mocks.date.MOCK_DATE)
if (!process.env.DEBUG) {
console.log = jest.fn() // console.log are ignored in tests
}
if (!process.env.CI) {
// set a longer timeout in dev for debugging
// 100 seconds
jest.setTimeout(100000)
}
2023-02-01 00:23:26 +13:00
testContainerUtils.setupEnv(env)
afterAll(() => {
cleanup()
})