2022-11-14 14:29:46 +01:00
|
|
|
import { Config } from "@jest/types"
|
2022-12-15 22:06:30 +01:00
|
|
|
const preset = require("ts-jest/jest-preset")
|
2022-11-14 14:29:46 +01:00
|
|
|
|
|
|
|
const config: Config.InitialOptions = {
|
2022-12-15 22:06:30 +01:00
|
|
|
...preset,
|
|
|
|
preset: "@trendyol/jest-testcontainers",
|
2022-11-14 14:29:46 +01:00
|
|
|
testEnvironment: "node",
|
2022-11-14 23:55:47 +01:00
|
|
|
setupFiles: ["./tests/jestSetup.ts"],
|
2022-11-14 14:29:46 +01:00
|
|
|
collectCoverageFrom: ["src/**/*.{js,ts}"],
|
|
|
|
coverageReporters: ["lcov", "json", "clover"],
|
2023-01-11 10:37:37 +01:00
|
|
|
transform: {
|
|
|
|
"^.+\\.ts?$": "@swc/jest",
|
|
|
|
},
|
2022-11-14 14:29:46 +01:00
|
|
|
}
|
|
|
|
|
2023-01-26 12:38:21 +01:00
|
|
|
if (!process.env.CI) {
|
|
|
|
// use sources when not in CI
|
|
|
|
config.moduleNameMapper = {
|
|
|
|
"@budibase/types": "<rootDir>/../types/src",
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
console.log("Running tests with compiled dependency sources")
|
|
|
|
}
|
|
|
|
|
2022-11-14 14:29:46 +01:00
|
|
|
export default config
|