with-tests

A testing guide that requires reviewing a codebase's test strategy before running or debugging tests. It covers common JavaScript and TypeScript test files, configurations, runners, and test directories.

In plain words
What is it for?
Use it to discover test scripts, map test files, inspect test setup, and run or debug the appropriate tests.
Why use it?
It helps an agent find the correct test command and understand setup, hooks, globals, and file organization before interpreting failures.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/zackiles/cursor-config/with-tests
Clone the repo
git clone --depth 1 https://github.com/zackiles/cursor-config

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,478 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.03478
Opus 5 $0.00000 $0.01739
Sonnet 5 $0.00000 $0.00696
Haiku 4.5 $0.00000 $0.00348

Measured 2d ago against content hash 17a137ea806f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

with-tests scanned grade A with 0 findings 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/global/with-tests.mdc · 230 lines

How it starts

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

Running Tests and Debugging Tests

BEFORE running or debugging tests in the codebase review the important information in this guide so you are better prepared to work with its testing strategy.

Context

• Test files: *.test.js, *.test.ts
• Config: package.json, package.jsonc, deno.json, deno.jsonc, bun.json, bun.jsonc, etc.
• Starting Tests: Deno tasks, NPM scripts, scripts/ folder, manually running a single test file if no global test runner exists, etc.
• Frameworks: Jest, Deno Test, etc.

Typical Tools Available

  • Discover test commands — locate runner scripts in config:
    grep_search(
      query: "\"test\":",
      include_pattern: "{package.json, package.jsonc, deno.json, deno.jsonc, bun.json, bun.jsonc}",
      explanation: "Find test scripts definitions"
    )
    
  • Map test structure — list test files to grasp layout:
    list_dir(
      relative_workspace_path: "test",
      explanation: "Examine test directory structure"
    )
    
  • Inspect setup — read entry file for globals, hooks, logging:
    read_file(
      target_file: "test/main.test.ts",
      should_read_entire_file: true,
      explanation: "Inspect test setup & config"
    )
    
  • Locate patterns — search for describe/it/test/assert/expect:
    codebase_search(
      query: "describe OR it OR test OR assert OR expect",
      explanation: "Locate test helpers across codebase"
    )
    
  • Execute & enrich errors — run tests, capture output, grep failures:
    run_terminal_cmd(
      command: "npm test || deno test || bun test",
      is_background: false,
      explanation: "Execute tests and capture output"
    )
    grep_search(
      query: "Error|fail|assert",
      include_pattern: "test/**/*.{ts,js}",
      explanation: "Locate error patterns in tests"
    )
    
  • Format logs — pretty-print, group, label for clarity
  • Find Debuggers — native runtime debuggers, test inspectors, test loggers, test telemetry, test tracing tools available

Read the full file on GitHub · 230 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. 2d ago First seen · 230 lines · 3,478 tokens per session scan A 17a137ea806f

Subscribe to this mod's changes

with-tests is a cursor rule published in the GitHub repository zackiles/cursor-config (17 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,478 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.