medusaIntegrationTestRunner Reference
This is a reference to the medusaIntegrationTestRunner
function provided by the @medusajs/test-utils
package.
Example#
Parameters#
Input
objectObject parameter of test options.
Input
objecttestSuite
(options: MedusaSuiteOptions) => voidThe Jest tests to run. It accepts Test Suite Parameters
testSuite
(options: MedusaSuiteOptions) => voiddbName
stringOptionalA name to use for the database. If not specified, the database name will be of the format medusa-<moduleName>-integration-<randomNumber>
.
dbName
stringOptionalmedusa-<moduleName>-integration-<randomNumber>
.schema
stringOptionalThe PostgreSQL schema that the database is created in.Default: public
schema
stringOptionalpublic
env
Record<string, any>OptionalEnvironment variables to pass to the test suite.
env
Record<string, any>Optionaldebug
booleanOptionalWhether to show database log messages.Default: false
debug
booleanOptionalfalse
moduleName
stringOptionalThe name of the module being tested. If not specified, a random name will be generated.
moduleName
stringOptionalmedusaConfigFile
stringOptionalThe path to the medusa-config.ts
file, excluding medusa-config.ts
. This path is used as the current working directory as well.Default: cwd (current working directory)
medusaConfigFile
stringOptionalmedusa-config.ts
file, excluding medusa-config.ts
. This path is used as the current working directory as well.cwd (current working directory)
hooks
objectOptionalAn object containing hooks to run at different points in the test lifecycle.
hooks
objectOptionalTest Suite Parameters#
The function passed to testSuite
accepts the following parameters:
Input
objectObject parameter of test utilities.
Input
objectapi
Record<string, Function>A set of methods used to send requests to the Medusa application.
api
Record<string, Function>getContainer
() => MedusaContainerA function that returns the Medusa container.
getContainer
() => MedusaContainerdbConfig
Record<string, string>The created database's configurations
dbConfig
Record<string, string>dbUtils
Record<string, Function>A set of methods to manage the database
dbUtils
Record<string, Function>utils
objectA set of utility functions for the test suite.
utils
objectWas this page helpful?