Fix coverage conflicts issues
This commit is contained in:
parent
4b1d47b900
commit
9b3cd812b7
|
@ -1,40 +1,40 @@
|
||||||
import { Config } from "jest"
|
import { Config } from "jest"
|
||||||
const preset = require("ts-jest/jest-preset")
|
const preset = require("ts-jest/jest-preset")
|
||||||
|
|
||||||
const configSettings = {
|
const testContainersSettings = {
|
||||||
...preset,
|
...preset,
|
||||||
preset: "@trendyol/jest-testcontainers",
|
preset: "@trendyol/jest-testcontainers",
|
||||||
setupFiles: ["./tests/jestEnv.ts"],
|
setupFiles: ["./tests/jestEnv.ts"],
|
||||||
setupFilesAfterEnv: ["./tests/jestSetup.ts"],
|
setupFilesAfterEnv: ["./tests/jestSetup.ts"],
|
||||||
collectCoverageFrom: ["src/**/*.{js,ts}"],
|
|
||||||
coverageReporters: ["lcov", "json", "clover"],
|
|
||||||
transform: {
|
transform: {
|
||||||
"^.+\\.ts?$": "@swc/jest",
|
"^.+\\.ts?$": "@swc/jest",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
...testContainersSettings,
|
||||||
|
displayName: "sequential test",
|
||||||
|
testMatch: ["<rootDir>/**/*.seq.spec.[jt]s"],
|
||||||
|
runner: "jest-serial-runner",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...testContainersSettings,
|
||||||
|
testMatch: ["<rootDir>/**/!(*.seq).spec.[jt]s"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
collectCoverageFrom: ["src/**/*.{js,ts}"],
|
||||||
|
coverageReporters: ["lcov", "json", "clover"],
|
||||||
|
}
|
||||||
|
|
||||||
if (!process.env.CI) {
|
if (!process.env.CI) {
|
||||||
// use sources when not in CI
|
// use sources when not in CI
|
||||||
configSettings.moduleNameMapper = {
|
config.moduleNameMapper = {
|
||||||
"@budibase/types": "<rootDir>/../types/src",
|
"@budibase/types": "<rootDir>/../types/src",
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Running tests with compiled dependency sources")
|
console.log("Running tests with compiled dependency sources")
|
||||||
}
|
}
|
||||||
|
|
||||||
const config: Config = {
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
...configSettings,
|
|
||||||
displayName: "sequential test",
|
|
||||||
testMatch: ["<rootDir>/**/*.seq.spec.[jt]s"],
|
|
||||||
runner: "jest-serial-runner",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
...configSettings,
|
|
||||||
testMatch: ["<rootDir>/**/!(*.seq).spec.[jt]s"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
|
|
|
@ -1,12 +1,28 @@
|
||||||
import { Config } from "jest"
|
import { Config } from "jest"
|
||||||
|
|
||||||
import * as fs from "fs"
|
import * as fs from "fs"
|
||||||
const preset = require("ts-jest/jest-preset")
|
const preset = require("ts-jest/jest-preset")
|
||||||
|
|
||||||
const configSettings = {
|
const testContainersSettings = {
|
||||||
...preset,
|
...preset,
|
||||||
preset: "@trendyol/jest-testcontainers",
|
preset: "@trendyol/jest-testcontainers",
|
||||||
setupFiles: ["./src/tests/jestEnv.ts"],
|
setupFiles: ["./src/tests/jestEnv.ts"],
|
||||||
setupFilesAfterEnv: ["./src/tests/jestSetup.ts"],
|
setupFilesAfterEnv: ["./src/tests/jestSetup.ts"],
|
||||||
|
}
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
...testContainersSettings,
|
||||||
|
displayName: "sequential test",
|
||||||
|
testMatch: ["<rootDir>/**/*.seq.spec.[jt]s"],
|
||||||
|
runner: "jest-serial-runner",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...testContainersSettings,
|
||||||
|
testMatch: ["<rootDir>/**/!(*.seq).spec.[jt]s"],
|
||||||
|
},
|
||||||
|
],
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: [
|
||||||
"src/**/*.{js,ts}",
|
"src/**/*.{js,ts}",
|
||||||
// The use of coverage with couchdb view functions breaks tests
|
// The use of coverage with couchdb view functions breaks tests
|
||||||
|
@ -20,33 +36,18 @@ const configSettings = {
|
||||||
|
|
||||||
if (!process.env.CI) {
|
if (!process.env.CI) {
|
||||||
// use sources when not in CI
|
// use sources when not in CI
|
||||||
configSettings.moduleNameMapper = {
|
config.moduleNameMapper = {
|
||||||
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
||||||
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
||||||
"@budibase/types": "<rootDir>/../types/src",
|
"@budibase/types": "<rootDir>/../types/src",
|
||||||
}
|
}
|
||||||
// add pro sources if they exist
|
// add pro sources if they exist
|
||||||
if (fs.existsSync("../../../budibase-pro")) {
|
if (fs.existsSync("../../../budibase-pro")) {
|
||||||
configSettings.moduleNameMapper["@budibase/pro"] =
|
config.moduleNameMapper["@budibase/pro"] =
|
||||||
"<rootDir>/../../../budibase-pro/packages/pro/src"
|
"<rootDir>/../../../budibase-pro/packages/pro/src"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Running tests with compiled dependency sources")
|
console.log("Running tests with compiled dependency sources")
|
||||||
}
|
}
|
||||||
|
|
||||||
const config: Config = {
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
...configSettings,
|
|
||||||
displayName: "sequential test",
|
|
||||||
testMatch: ["<rootDir>/**/*.seq.spec.[jt]s"],
|
|
||||||
runner: "jest-serial-runner",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
...configSettings,
|
|
||||||
testMatch: ["<rootDir>/**/!(*.seq).spec.[jt]s"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
|
|
Loading…
Reference in New Issue