node-testing

node-testing is a cursor rule for Cursor from adonai-labs/agent-runway. It costs 0 tokens per session (571 once invoked), scanned A, original, MIT.

A set of testing guidelines for Node.js applications. It covers HTTP APIs, process shutdown, queue consumers, streams, and tests that use real infrastructure in containers.

In plain words
What is it for?
Use it to test Node.js servers, workers, queues, streams, and startup or shutdown behaviour without relying only on simple unit tests.
Why use it?
It helps catch incorrect status codes, shutdown failures, duplicate message processing, and failures in databases or downstream services.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to test Node.js servers, workers, queues, streams, and startup or shutdown behaviour without relying only on simple unit tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/adonai-labs/agent-runway/node-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/adonai-labs/agent-runway

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for node-testing

README.md
[![agentmods](https://agentmods.dev/badge/rules/adonai-labs/agent-runway/node-testing/github.svg)](https://agentmods.dev/rules/adonai-labs/agent-runway/node-testing)
Your own site
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/node-testing"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/node-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for node-testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/node-testing"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/node-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 571 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00571
Opus 5 $0.00000 $0.00285
Sonnet 5 $0.00000 $0.00114
Haiku 4.5 $0.00000 $0.00057

Measured 7d ago against content hash 8c035bb6cf47, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

node-testing scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- Test `SIGTERM` and `SIGINT` handling via `child_process.fork()` — verify clean exit with code `0`
src/stacks/node/node-testing.mdc · 63 lines

How it starts

The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Node.js Testing Guidelines

Applied when working with Node.js test files and configuration. Australian English spelling throughout.


API Testing

  • Use Supertest to test HTTP routes without starting a real server; bind directly to the app instance
  • Build the app with injected test dependencies — do not start with app.listen() in tests
  • Test every HTTP status code path: success, validation failure (400), auth failure (401/403), not found (404), server error (500)
  • Assert Content-Type and response shape for all API endpoints

Process Lifecycle Testing

  • Test SIGTERM and SIGINT handling via child_process.fork() — verify clean exit with code 0
  • Verify the process exits with a non-zero code on startup failure (missing env, failed DB connection)
  • Test that the server stops accepting new requests before shutdown dependencies are closed

Queue Consumer Testing

  • Test consumer message handlers as plain functions — inject a fake queue client
  • Always test idempotency: processing the same message twice must not cause duplicate side effects
  • Test error handling: what happens when the handler throws, the DB is unavailable, or a downstream call fails

Stream Testing

  • Test Transform streams independently using Readable.from() as input and a collecting Writable as output
  • Use pipeline from node:stream/promises in tests — it propagates errors correctly
  • Test back-pressure: verify the stream does not consume unbounded memory on slow consumers

Integration Testing

  • Use Testcontainers for real PostgreSQL, Redis, Kafka, or other infrastructure dependencies
  • Start containers in beforeAll, truncate state in beforeEach, stop in afterAll
  • Set a generous timeout on beforeAll (≥60s) — container startup in CI can be slow
  • Do not use in-memory SQLite as a Postgres proxy — behaviour differs

Checklist

  • HTTP routes tested with Supertest; all status codes covered
  • Process shutdown tested via child_process.fork()
  • Queue consumer idempotency tested explicitly
  • Stream transformers tested independently
  • Integration tests use Testcontainers; CI runs them separately from unit tests
  • No shared mutable state between tests; state reset in beforeEach

Read the full file on GitHub · 63 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 63 lines · 0 tokens per session scan A 8c035bb6cf47

Subscribe to this mod's changes

node-testing is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 20d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 571 tokens. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.