2023-01-23 17:45:06 +01:00
|
|
|
import env from "../environment"
|
2024-08-09 14:36:22 +02:00
|
|
|
import * as matchers from "jest-extended"
|
2023-03-27 20:38:49 +02:00
|
|
|
import { env as coreEnv, timers } from "@budibase/backend-core"
|
2023-01-31 12:23:26 +01:00
|
|
|
import { testContainerUtils } from "@budibase/backend-core/tests"
|
2024-08-01 12:57:04 +02:00
|
|
|
import nock from "nock"
|
2022-05-30 22:46:08 +02:00
|
|
|
|
2024-08-09 14:36:22 +02:00
|
|
|
expect.extend(matchers)
|
2022-11-14 14:29:46 +01:00
|
|
|
if (!process.env.CI) {
|
2024-03-27 17:57:31 +01:00
|
|
|
// set a longer timeout in dev for debugging 100 seconds
|
2023-02-09 10:19:31 +01:00
|
|
|
jest.setTimeout(100 * 1000)
|
|
|
|
} else {
|
2024-03-27 17:57:31 +01:00
|
|
|
jest.setTimeout(30 * 1000)
|
2022-11-14 14:29:46 +01:00
|
|
|
}
|
2023-01-23 17:45:06 +01:00
|
|
|
|
2024-08-01 12:57:04 +02:00
|
|
|
nock.disableNetConnect()
|
|
|
|
nock.enableNetConnect(host => {
|
|
|
|
return (
|
|
|
|
host.includes("localhost") ||
|
|
|
|
host.includes("127.0.0.1") ||
|
|
|
|
host.includes("::1")
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2023-01-31 12:23:26 +01:00
|
|
|
testContainerUtils.setupEnv(env, coreEnv)
|
2023-03-27 20:38:49 +02:00
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
timers.cleanup()
|
|
|
|
})
|