2022-11-14 14:29:46 +01:00
|
|
|
import { Config } from "@jest/types"
|
|
|
|
import * as fs from "fs"
|
|
|
|
|
|
|
|
const config: Config.InitialOptions = {
|
2024-03-26 10:51:10 +01:00
|
|
|
globalSetup: "./../../globalSetup.ts",
|
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-05-19 10:36:23 +02:00
|
|
|
"@budibase/shared-core": ["<rootDir>/../shared-core/src"],
|
2024-03-15 13:40:14 +01:00
|
|
|
"@budibase/string-templates": ["<rootDir>/../string-templates/src"],
|
2023-02-21 18:13:24 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-04-14 18:18:15 +02:00
|
|
|
// add pro sources if they exist
|
2023-06-19 19:34:51 +02:00
|
|
|
if (fs.existsSync("../pro/src")) {
|
|
|
|
config.moduleNameMapper!["@budibase/pro/(.*)"] = "<rootDir>/../pro/$1"
|
|
|
|
config.moduleNameMapper!["@budibase/pro"] = "<rootDir>/../pro/src"
|
2023-04-14 18:18:15 +02:00
|
|
|
}
|
|
|
|
|
2022-11-14 14:29:46 +01:00
|
|
|
export default config
|