2022-11-14 14:29:46 +01:00
|
|
|
import { Config } from "@jest/types"
|
|
|
|
import * as fs from "fs"
|
2023-01-27 18:59:14 +01:00
|
|
|
const preset = require("ts-jest/jest-preset")
|
2022-11-14 14:29:46 +01:00
|
|
|
|
|
|
|
const config: Config.InitialOptions = {
|
2023-01-27 18:59:14 +01:00
|
|
|
...preset,
|
|
|
|
preset: "@trendyol/jest-testcontainers",
|
2023-01-11 10:37:37 +01:00
|
|
|
setupFiles: ["./src/tests/jestEnv.ts"],
|
|
|
|
setupFilesAfterEnv: ["./src/tests/jestSetup.ts"],
|
2023-02-27 18:07:52 +01:00
|
|
|
collectCoverageFrom: ["src/**/*.{js,ts}", "../backend-core/src/**/*.{js,ts}"],
|
2022-11-14 14:29:46 +01:00
|
|
|
coverageReporters: ["lcov", "json", "clover"],
|
2023-01-11 10:37:37 +01:00
|
|
|
transform: {
|
|
|
|
"^.+\\.ts?$": "@swc/jest",
|
|
|
|
},
|
2023-02-21 18:13:24 +01:00
|
|
|
moduleNameMapper: {
|
2023-01-27 13:36:52 +01:00
|
|
|
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
|
|
|
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
|
|
|
"@budibase/types": "<rootDir>/../types/src",
|
2023-02-21 18:13:24 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-04-14 18:18:15 +02:00
|
|
|
// add pro sources if they exist
|
2023-04-20 20:30:48 +02:00
|
|
|
if (fs.existsSync("../pro/packages")) {
|
|
|
|
config.moduleNameMapper!["@budibase/pro/(.*)"] =
|
|
|
|
"<rootDir>/../pro/packages/pro/$1"
|
|
|
|
config.moduleNameMapper!["@budibase/pro"] =
|
|
|
|
"<rootDir>/../pro/packages/pro/src"
|
2023-04-14 18:18:15 +02:00
|
|
|
}
|
|
|
|
|
2022-11-14 14:29:46 +01:00
|
|
|
export default config
|