medusaIntegrationTestRunner Reference
This is a reference to the medusaIntegrationTestRunner function provided by the @medusajs/test-utils package.
Example#
Parameters#
InputobjectObject parameter of test options.
InputobjecttestSuite(options: MedusaSuiteOptions) => voidThe Jest tests to run. It accepts Test Suite Parameters
testSuite(options: MedusaSuiteOptions) => voiddbNamestringOptionalA name to use for the database. If not specified, the database name will be of the format medusa-<moduleName>-integration-<randomNumber>.
dbNamestringOptionalschemastringOptionalThe PostgreSQL schema that the database is created in.Default: public
schemastringOptionalpublicenvRecord<string, any>OptionalEnvironment variables to pass to the test suite.
envRecord<string, any>OptionaldebugbooleanOptionalWhether to show database log messages.Default: false
debugbooleanOptionalfalsemoduleNamestringOptionalThe name of the module being tested. If not specified, a random name will be generated.
moduleNamestringOptionalmedusaConfigFilestringOptionalThe 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)
medusaConfigFilestringOptionalcwd (current working directory)hooksobjectOptionalAn object containing hooks to run at different points in the test lifecycle.
hooksobjectOptionalTest Suite Parameters#
The function passed to testSuite accepts the following parameters:
InputobjectObject parameter of test utilities.
InputobjectapiRecord<string, Function>A set of methods used to send requests to the Medusa application.
apiRecord<string, Function>getContainer() => MedusaContainerA function that returns the Medusa container.
getContainer() => MedusaContainerdbConfigRecord<string, string>The created database's configurations
dbConfigRecord<string, string>dbUtilsRecord<string, Function>A set of methods to manage the database
dbUtilsRecord<string, Function>utilsobjectA set of utility functions for the test suite.
utilsobjectWas this page helpful?