Quickstart

Install Testkit as a development dependency and begin with one behaviour that is important to a real user.

1. Install as a development dependency

Shell
npm install --save-dev @(scope)/testkit

Testkit supports Node.js >=22.15.0 <23.0.0 or >=24.14.1 <25.0.0; it is for development and CI, not production runtime code.

2. Add a colocated suite

Create a __testkit__/ directory beside the product surface it verifies. File suffixes state the test type; every suite also declares its explicit engine with defineFile. Testkit never picks an engine implicitly.

TypeScript
// src/api/routes/__testkit__/health.int.testkit.ts
import { defineFile } from "@(scope)/testkit";
import { defineHttpSuite, expect } from "@(scope)/testkit/k6";

export const testkit = defineFile({ engine: "k6" });

const suite = defineHttpSuite(({ rawReq }) => {
  const response = rawReq.get("/health");
  expect.status(response, 200, "health returns 200");
});

export const options = suite.options;
export const setup = suite.setup;
export default suite.exec;

3. Run the suite

Shell
npx testkit run

Run every discovered suite in batch mode. Testkit records service logs, runtime output, and emitted artifacts under .testkit/results/.