@temporal-contract/testing / global-setup
global-setup
Type Aliases
CreateGlobalSetupOptions
type CreateGlobalSetupOptions = object;Defined in: global-setup.ts:36
Options for createGlobalSetup.
Properties
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
postgresImage? | string | "postgres:18.1" | PostgreSQL image reference backing the Temporal server. | global-setup.ts:42 |
quiet? | boolean | false | Silence the container-progress console.logs. Teardown failures still log via console.error. | global-setup.ts:61 |
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:54 |
temporalImage? | string | "temporalio/auto-setup:1.29.1" | Temporal auto-setup image reference — pin this to test against a specific server version. | global-setup.ts:49 |
Variables
default
default: (project) => Promise<() => Promise<void>>;Defined in: global-setup.ts:203
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:86
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,
});