test-scripts

test-scripts is a cursor rule for Cursor from YuDefine/nuxt-supabase-starter. It costs 0 tokens per session (2,357 once invoked), scanned A, original, MIT.

A Vitest test-script rule for projects that contain multiple test projects. It requires selecting a project by name instead of filtering tests with a fixed directory path.

In plain words
What is it for?
It helps configure package scripts for unit, integration, framework-specific, and single-file tests in multi-project Vitest setups.
Why use it?
A fixed path can silently exclude an entire test project while still returning a successful result. The rule keeps project-specific commands and single-file test commands from reporting success without running the intended test.

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/yudefine/nuxt-supabase-starter/test-scripts
Clone the repo
git clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starter

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 test-scripts

README.md
[![agentmods](https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/test-scripts.svg)](https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/test-scripts)
Your own site
<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/test-scripts"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/test-scripts.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,357 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.02357
Opus 5 $0.00000 $0.01179
Sonnet 5 $0.00000 $0.00471
Haiku 4.5 $0.00000 $0.00236

Measured yesterday against content hash 1d5dfb80bcd7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-scripts 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 yesterday.

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.

template/.cursor/rules/test-scripts.mdc · 170 lines

How it starts

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

Test Scripts

核心命題:vitest multi-project 配置(projects: [...]test.workspace)下,package.jsontest:* script 若寫死路徑當 path filter(例如 vp test run test/unit),會把不在該路徑下的 project 整個排除。開發者跑 pnpm test:unit -- <該 project 範圍外的單檔> 時 vitest 靜默不跑(無錯誤、無警告、回 0 fail),開發者誤以為通過但實際根本沒執行。

此規則優先於個別 consumer 既有的 script 命名習慣。

適用範圍

  • 觸發條件vitest.config.tsprojects: [...](或 test.workspace)且 ≥ 2 個 project
  • 不適用:單一 project 配置(一個 include),或非 vitest 測試框架(jest、bun:test 等)

MUST

--project=<name> 取代寫死路徑

每個 vitest project MUSTpackage.json 有對應 test:<project> script,使用 --project=<name> flag:

{
  "scripts": {
    "test": "vp test run --coverage",
    "test:file": "vp test run",
    "test:unit": "vp test run --project=unit",
    "test:nuxt": "vp test run --project=nuxt",
    "test:integration": "vp test run --project=integration"
  }
}
  • test:跑全部 projects(CI 預設)
  • test:<project>:嚴格只跑單一 project,限 path
  • test:file:無 filter 的 escape hatch,跑單檔時 vitest 自動匹配對應 project(MUST 提供)

跑單檔的標準作法

跑單檔測試時,MUST 使用以下任一形式:

pnpm test:file <path>           # 推薦:明確走 escape hatch
pnpm vp test run <path>         # 等價:直接呼叫 vp

vitest 會依 vitest.config.ts 內各 project 的 include / exclude 自動把該 path 路由到對應 project。

NEVER

禁止把路徑寫進 test:<project> script

// ❌ 錯誤——把路徑當 filter 寫死,跨 project 單檔測試會靜默跳過
{
  "scripts": {
    "test:unit": "vp test run test/unit",
    "test:nuxt": "vp test run app"
  }
}

寫死路徑的問題:

  • pnpm test:unit -- app/pages/foo.test.ts 經 npm script 展開為 vp test run test/unit app/pages/foo.test.ts
  • vitest 把兩者都當 path filter,行為不一致(依版本可能 0 file matched 或部分匹配)
  • 開發者無法明確知道 test 是否真的跑了該檔

禁止以 pnpm test:<project> -- <path> 形式跑單檔

即使 script 本身正確(--project=<name>),加了 -- <path> 等於把 path filter 限到那個 project 的 include 範圍。MUST 改用 pnpm test:file <path>

Read the full file on GitHub · 170 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. yesterday First seen · 170 lines · 0 tokens per session scan A 1d5dfb80bcd7

Subscribe to this mod's changes

test-scripts is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,357 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-09-03.