# medusaIntegrationTestRunner Reference

This is a reference to the `medusaIntegrationTestRunner` function provided by the `@medusajs/test-utils` package.

## Example

```ts
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"

medusaIntegrationTestRunner({
  testSuite: ({ api, getContainer }) => {
    // TODO write tests...
  },
})
```

## Parameters

- Input: (\`object\`) Object parameter of test options.

  - testSuite: (\`(options: MedusaSuiteOptions) => void\`) The Jest tests to run. It accepts \[Test Suite Parameters]\(#test-suite-parameters)

  - dbName: (\`string\`) A name to use for the database. If not specified, the database name will be of the format \`medusa-\<moduleName>-integration-\<randomNumber>\`.

  - schema: (\`string\`) The PostgreSQL schema that the database is created in.

  - env: (\`Record\<string, any>\`) Environment variables to pass to the test suite.

  - debug: (\`boolean\`) Whether to show database log messages.

  - moduleName: (\`string\`) The name of the module being tested. If not specified, a random name will be generated.

  - medusaConfigFile: (\`string\`) The path to the \`medusa-config.ts\` file, excluding \`medusa-config.ts\`. This path is used as the current working directory as well.

  - hooks: (\`object\`) An object containing hooks to run at different points in the test lifecycle.

    - beforeServerStart: (\`(container: MedusaContainer) => Promise\<void>\`) A hook that runs before the Medusa server starts.

## Test Suite Parameters

The function passed to `testSuite` accepts the following parameters:

- Input: (\`object\`) Object parameter of test utilities.

  - api: (Record\<string, Function>) A set of methods used to send requests to the Medusa application.

    - get: ((path: string) => Promise\<any>) Send a GET request to the specified path.

    - post: ((path: string, data?: any) => Promise\<any>) Send a POST request to the specified path.

    - delete: ((path: string) => Promise\<any>) Send a DELETE request to the specified path.

  - getContainer: (\`() => MedusaContainer\`) A function that returns the Medusa container.

  - dbConfig: (\`Record\<string, string>\`) The created database's configurations

    - dbName: (\`string\`) The database's name.

    - schema: (\`string\`) The PostgreSQL schema the database is created in.

    - clientUrl: (\`string\`) The connection URL to the database.

  - dbUtils: (\`Record\<string, Function>\`) A set of methods to manage the database

    - create: (\`(dbName: string) => Promise\<void>\`) Creates a database.

    - teardown: (\`(options: \{ schema?: string }) => Promise\<void>\`) Deletes all data in a database's tables.

    - shutdown: (\`(dbName: string) => Promise\<void>\`) Drops a database.

  - utils: (\`object\`) A set of utility functions for the test suite.

    - waitWorkflowExecutions: (\`() => Promise\<void>\`) Waits for all workflow executions to complete.
