chore(medusa-test-utils): Add debug option to the module test runner (#6462)

**What**
Add a debug options to the test runner, for now it will only switch the db to log the query but it could evolve to do more debug.
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-02-21 13:01:03 +00:00
1 parent 8ff838970e
commit e0750bae40
2 files changed
+5 -1

No files matched your search

@@ -13,7 +13,7 @@ import {
UpdateServiceZoneDTO,
} from "@medusajs/types"
import { GeoZoneType } from "@medusajs/utils"
import { SuiteOptions, moduleIntegrationTestRunner } from "medusa-test-utils"
import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils"
jest.setTimeout(100000)
@@ -18,6 +18,7 @@ export function moduleIntegrationTestRunner({
moduleModels,
joinerConfig = [],
schema = "public",
debug = false,
testSuite,
}: {
moduleName: string
@@ -25,6 +26,7 @@ export function moduleIntegrationTestRunner({
joinerConfig?: any[]
schema?: string
dbName?: string
debug?: boolean
testSuite: <TService = unknown>(options: SuiteOptions<TService>) => () => void
}) {
moduleModels = Object.values(require(`${process.cwd()}/src/models`))
@@ -36,6 +38,7 @@ export function moduleIntegrationTestRunner({
const dbConfig = {
clientUrl: getDatabaseURL(dbName),
schema,
debug,
}
// Use a unique connection for all the entire suite
@@ -54,6 +57,7 @@ export function moduleIntegrationTestRunner({
defaultAdapterOptions: {
database: dbConfig,
},
database: dbConfig,
},
},
}