Skip to content

@temporal-contract/testing


@temporal-contract/testing / global-setup

global-setup ​

Type Aliases ​

CreateGlobalSetupOptions ​

ts
type CreateGlobalSetupOptions = object;

Defined in: global-setup.ts:36

Options for createGlobalSetup.

Properties ​

PropertyTypeDefault valueDescriptionDefined in
postgresImage?string"postgres:18.1"PostgreSQL image reference backing the Temporal server.global-setup.ts:42
quiet?booleanfalseSilence the container-progress console.logs. Teardown failures still log via console.error.global-setup.ts:61
temporalEnv?Record<string, string>undefinedExtra 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 ​

ts
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 ​

ParameterType
projectTestProject

Returns ​

Promise<() => Promise<void>>

Functions ​

createGlobalSetup() ​

ts
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 ​

ParameterType
optionsCreateGlobalSetupOptions

Returns ​

(project) => Promise<() => Promise<void>>

Example ​

ts
// temporal-global-setup.ts
import { createGlobalSetup } from "@temporal-contract/testing/global-setup";

export default createGlobalSetup({
  temporalImage: "temporalio/auto-setup:1.28.0",
  quiet: true,
});

Released under the MIT License.