@temporal-contract/testing / global-setup
global-setup
Type Aliases
CreateGlobalSetupOptions
type CreateGlobalSetupOptions = object;Defined in: global-setup.ts:38
Options for createGlobalSetup.
Properties
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
healthCheckRetries? | number | undefined | The startup budget counted in health checks, one per second. Deprecated Use CreateGlobalSetupOptions.startupTimeoutMs; when it is unset, healthCheckRetries seconds is used as the budget. | global-setup.ts:69 |
postgresImage? | string | "postgres:18.1@sha256:1090bc3a…" | PostgreSQL image reference backing the Temporal server. The default is pinned by digest; pass a tag or another digest to override it. | global-setup.ts:45 |
quiet? | boolean | false | Silence the container-progress console.logs. Teardown failures still log via console.error. | global-setup.ts:81 |
startupTimeoutMs? | number | 180_000 (three minutes) | How long each container may take to become healthy, in milliseconds, before startup fails. Failed health checks inside this window do not count against the container, so temporalio/auto-setup can create its schemas on a loaded Docker host — raise it on slow CI runners or when the images still have to be pulled. | global-setup.ts:62 |
temporalEnv? | Record<string, string> | undefined | Extra environment variables merged into the Temporal container (e.g. dynamic-config knobs). Keys given here override the built-in defaults. | global-setup.ts:74 |
temporalImage? | string | "temporalio/auto-setup:1.29.1@sha256:5b3502a3…" | Temporal auto-setup image reference — pin this to test against a specific server version. The default is pinned by digest. | global-setup.ts:52 |
Variables
default
default: (project) => Promise<() => Promise<void>>;Defined in: global-setup.ts:232
Default Vitest globalSetup — createGlobalSetup with the stock images and settings. Reference it directly from a vitest config: globalSetup: "@temporal-contract/testing/global-setup".
Parameters
| Parameter | Type |
|---|---|
project | TestProject |
Returns
Promise<() => Promise<void>>
Functions
createGlobalSetup()
function createGlobalSetup(options?): (project) => Promise<() => Promise<void>>;Defined in: global-setup.ts:106
Build a Vitest globalSetup function that starts a Temporal server (PostgreSQL + temporalio/auto-setup) via testcontainers before all tests and provides its address to the fixtures in @temporal-contract/testing/extension and @temporal-contract/testing/contract.
The package's default export is createGlobalSetup() — reference this factory from your own global-setup module only when you need to pin images, inject extra Temporal env, or silence the progress logs:
Parameters
| Parameter | Type |
|---|---|
options | CreateGlobalSetupOptions |
Returns
(project) => Promise<() => Promise<void>>
Example
// temporal-global-setup.ts
import { createGlobalSetup } from "@temporal-contract/testing/global-setup";
export default createGlobalSetup({
temporalImage: "temporalio/auto-setup:1.28.0",
quiet: true,
});