budibase/packages/worker/jest.config.ts

32 lines
1.0 KiB
TypeScript
Raw Normal View History

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")
const config: Config.InitialOptions = {
2023-01-27 18:59:14 +01:00
...preset,
preset: "@trendyol/jest-testcontainers",
setupFiles: ["./src/tests/jestEnv.ts"],
setupFilesAfterEnv: ["./src/tests/jestSetup.ts"],
collectCoverageFrom: ["src/**/*.{js,ts}", "../backend-core/src/**/*.{js,ts}"],
coverageReporters: ["lcov", "json", "clover"],
transform: {
"^.+\\.ts?$": "@swc/jest",
},
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"],
},
}
2023-04-14 18:18:15 +02:00
// add pro sources if they exist
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
}
export default config