@temporal-contract/testing
v0.2.0
Published
Temporal testing utilities
Readme
@temporal-contract/testing
Testing utilities for temporal-contract integration tests
Installation
pnpm add -D @temporal-contract/testingQuick Example
Global Setup
Configure Vitest to start a Temporal server before all tests:
// vitest.config.ts
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globalSetup: "@temporal-contract/testing/global-setup",
testTimeout: 60000,
},
});Test Extension
Use the it extension for automatic connection management:
// my-workflow.spec.ts
import { it } from "@temporal-contract/testing/extension";
import { expect } from "vitest";
it("should execute workflow", async ({ clientConnection, workerConnection }) => {
// clientConnection: Connection from @temporalio/client (auto-connected, auto-closed)
// workerConnection: NativeConnection from @temporalio/worker (auto-connected)
const client = new Client({ connection: clientConnection });
// ... use client and workerConnection in your test
});Documentation
📖 Read the full documentation →
License
MIT
