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
2024-02-21 14:01:03 +01:00
committed by GitHub
parent 8ff838970e
commit e0750bae40
2 changed files with 5 additions and 1 deletions

View File

@@ -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)

View File

@@ -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,
},
},
}