用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/hackerbara/changedown --skill testing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Use ChangeDown from Codex via MCP to read tracked Markdown, propose durable CriticMarkup changes, review changes, and work with active Word sessions. Use before editing Markdown in a ChangeDown-tracked project or when the user mentions ChangeDown, tracked changes, CriticMarkup, review changes, or word:// sessions.
Durable change tracking with annotations for AI agents
基于 SOC 职业分类
| name | testing |
| description | How to write and run tests in the ChangeDown monorepo. Use before writing any test code. |
This project follows Paul Duvall's ATDD two-tier model:
Tier 1 — Gherkin (behaviors): Every user-facing capability has a .feature file. Write the feature file FIRST, then implement. This is the behavioral contract.
Tier 2 — Native (edge cases): Parser permutations, data-driven matrices, and internal function tests use .test.ts files with Mocha or Vitest. These cover exhaustive edge cases that don't need Gherkin ceremony.
Rule: No implementation without a corresponding behavioral spec. Write the .feature file first.
Is this a user-facing behavior, capability, or flow?
YES → Write a .feature file FIRST
VS Code extension behavior? → @slow tag, packages/tests/vscode/features/
Core/engine/hooks/mcp behavior? → packages/tests/features/
NO → Edge-case matrix or internal function test?
YES → .test.ts file (Mocha for core/lsp, Vitest for engine/mcp/hooks)
NO → Does this test need to exist?
| What | Where | Runner |
|---|---|---|
| Core behavioral features | packages/tests/features/core/*.feature | cucumber-js |
| Engine behavioral features | packages/tests/features/engine/*.feature | cucumber-js |
| Hooks behavioral features | packages/tests/features/hooks/*.feature | cucumber-js |
| MCP journey features | packages/tests/features/journeys/*.feature | cucumber-js |
| MCP operation features | packages/tests/features/ops/*.feature | cucumber-js |
| VS Code extension features | packages/tests/vscode/features/*.feature | cucumber-js + Playwright |
| Core unit tests | packages/tests/core/*.test.ts | Mocha |
| Engine unit tests | packages/tests/engine/*.test.ts | Vitest |
| LSP unit tests | packages/tests/lsp/*.test.ts | Mocha |
| MCP unit tests | packages/tests/mcp/*.test.ts | Vitest |
| Hooks unit tests | packages/tests/hooks/*.test.ts | Vitest |
| Step definitions (core) | packages/tests/features/steps/ | — |
| Step definitions (vscode) | packages/tests/vscode/features/steps/ | — |
Before writing a new step definition → grep existing steps/ directories for similar patterns.
Before creating a helper function → check packages/tests/vscode/journeys/playwrightHarness.ts.
Before adding a bridge command → check packages/vscode-extension/src/commands/test-commands.ts.
VS Code extension tests use Playwright to control an Electron instance. The harness has specific patterns that MUST be followed:
Bridge commands (use these, not command palette):
executeCommandViaBridge(page, 'changedown.commandName') — reliable command executionupdateSettingDirect(page, key, value) — write to settings.json directlygetDocumentText(page, { instanceId }) — reads temp file IPC, not Monaco DOMqueryPanelState(page) — reads panel state via bridge (local helper in panel.steps.ts)NEVER do these:
executeCommand() via command palette (MRU fuzzy-match breaks)Polling pattern: 200ms intervals, 3s timeout, timestamp validation for stale reads.
Instance batching: VS Code instances are shared per fixture file across scenarios. Use @destructive tag for scenarios that modify fixture files.
Existing bridge commands in test-commands.ts:
_testQueryPanelState, _testGetDocumentText, _testResetDocument, _testExecuteCommand, _testPasteClipboard, _testUpdateSetting, _testWaitForChanges, _testGetCursorPosition
ALWAYS capture test output to a dated file in docs/findings/:
# Correct — output is saved for other agents to analyze
npm run test:slow 2>&1 | tee docs/findings/YYYY-MM-DD-slow-suite-run.txt
# WRONG — output lost, forces expensive re-run
npm run test:slow
npm run test:slow | tail -5
npm run test:slow > /tmp/results.txt
Other agents need to read results without re-running a 5-minute suite. Never pipe to /tmp/ (cleared on reboot) or discard output.
When a change touches shared code, verify across surfaces:
| Changed | Also run |
|---|---|
| Core parser | MCP journey features + VS Code @fast + @slow decoration scenarios |
| Footnote format | Core features + MCP propose/review journeys + VS Code accept/reject |
| Decoration logic | VS Code @slow D1-D9 + visual regression |
| Hook behavior | Hooks features H1-H5 + VS Code tracking scenarios |
| Status/metadata chain | Review panel scenarios + hover scenarios + MCP read features |
Run the affected cross-package scenarios, not just the unit tests in the package you changed.
# Build everything first (always)
npm run build
# Core/engine/hooks/mcp cucumber features
cd packages/tests && /usr/bin/env npx cucumber-js --config features/cucumber.mjs
# VS Code @fast (parser, in-process, <1s)
cd packages/tests/vscode && npm run test:fast
# VS Code @slow (Playwright + VS Code, 3-5 min)
cd packages/tests/vscode && npm run test:slow
# Single scenario by tag
cd packages/tests/vscode && npm run test:slow -- --tags '@J5'
# Single scenario by name
cd packages/tests/vscode && /usr/bin/env npx cucumber-js --config features/cucumber.mjs --name 'tracks insertion'
# Unit tests
cd packages/tests && npm run test:vitest # engine/mcp/hooks
cd packages/tests && npm run test:mocha # core/lsp
# ALWAYS tee output for other agents
npm run test:slow 2>&1 | tee docs/findings/YYYY-MM-DD-description.txt