Registry / testing / testurio

testurio

JSON →
library0.6.5jsnpmunverified

A declarative E2E/integration testing framework for distributed systems, currently at v0.6.5 (alpha stage, frequent releases). Supports multiple protocols (HTTP, gRPC, WebSocket, TCP) and data sources (Redis, PostgreSQL, MongoDB, ClickHouse) out of the box. Unlike Jest or Cypress, Testurio focuses on multi-protocol flow testing with component-based architecture, built-in mocking/proxying, and a native expect() API free of external assertion libraries. TypeScript-first with full type inference.

npm install testurio
INSTALL
IMPORT
SIG · TESTURIO
T
testurio
testingjavascriptv0.6.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TestScenario
import { TestScenario } from 'testurio'
import TestScenario from 'testurio'
TestScenario is a named export, not a default export
Client
import { Client } from 'testurio'
const Client = require('testurio').Client
CommonJS require is not supported; ESM-only since v0.5
HttpProtocol
import { HttpProtocol } from 'testurio'
import { HttpProtocol } from 'testurio/protocol-http'
HttpProtocol is re-exported from the main package, no subpath import needed
expect
import { expect } from 'testurio'
import { expect } from 'chai'
Testurio provides its own expect function; using chai/vitest expect will not work with testurio's assertion system

Demonstrates creating a mock HTTP server and a client, defining a declarative test case with request/response mocking, and running it with TestScenario.

import { TestScenario, testCase, Client, Server, HttpProtocol, expect } from 'testurio'; const httpClient = new Client('client', { protocol: new HttpProtocol(), targetAddress: { host: 'localhost', port: 3000 }, }); const httpServer = new Server('mock', { protocol: new HttpProtocol(), listenAddress: { host: 'localhost', port: 3000 }, }); const scenario = new TestScenario({ name: 'User API Test' }); const tc = testCase('Get user by ID', (test) => { const client = test.use(httpClient); const mock = test.use(httpServer); client.request('getUsers', { method: 'GET', path: '/users' }); mock .onRequest('getUsers', { method: 'GET', path: '/users' }) .mockResponse(() => ({ code: 200, body: [{ id: 1, name: 'Alice', email: 'alice@example.com' }], })); client .onResponse('getUsers') .assert((res) => { expect(res.code).toBe(200); expect(res.body).toMatchObject([{ id: 1, name: 'Alice' }]); }); }); const result = await scenario.run(tc); console.log(result.passed); // true
Debug
Known issues
breakingAPI not stable; may change without notice in minor versions.
fix
Pin exact version and monitor changelog before upgrading.
affects: <=0.6.5
deprecatedtesturio/core import path removed in v0.6.
fix
Use 'testurio' directly instead of 'testurio/core'.
affects: >=0.5 <0.6
gotchatesturio provides its own `expect()` that returns undefined for pass; using vitest/jest expect will break assertions.
fix
Always import `expect` from 'testurio', not from testing frameworks.
affects: >=0.1
gotchaProtocol packages like @testurio/protocol-grpc must be installed separately; they are not included in the main testurio package.
fix
Install @testurio/protocol-grpc, @testurio/protocol-ws, etc. as needed.
affects: >=0.1
deprecatedtestCase() callback signature changed: the `test` argument now receives `test.use()` instead of `test.client()`.
fix
Update code to use `test.use(httpClient)` instead of `test.client('clientName')`.
affects: >=0.4 <0.5
Errors
Common errors & fixes
Error: Cannot find module 'testurio'
testurio not installed or not in node_modules
fix
Run `npm install testurio --save-dev`
TypeError: expect(...).toBe is not a function
Using vitest/jest expect instead of testurio's expect
fix
Import `expect` from `testurio`: `import { expect } from 'testurio'`
Error: Protocol 'grpc' is not registered. Did you install @testurio/protocol-grpc?
Missing optional protocol package
fix
Run `npm install @testurio/protocol-grpc --save-dev` and import the protocol
TypeError: test.use is not a function
Using old testCase callback signature from testurio <0.5
fix
Update testurio to >=0.5 and use `test.use(client)` instead of `test.client('name')`
Upgrade
Version history
0.6.5latest on npm
Audit
Dependencies
zodoptionalSchema validation and type inference for test definitions
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
testurio — npm install testurio · libregistry