testing-conventions
БесплатноБез исполняемых скриптовНе проверенUse when adding or changing tests, the e2e harness, fake CLIs in pipeline-step tests, test process isolation, or CI test sharding.
от kunchenguid★ 9 314 звёзд на GitHubОб этом скилле
Testing Conventions
- Prefer e2e tests for behavior that crosses a process or I/O boundary (CLI flags, config loading, git operations, agent spawning, daemon coordination, stdout/stderr, recorded fixtures); unit-test pure helpers where speed and failure localization matter. Prefer creating real git repos in temp dirs over heavy mocking.
- The e2e suite is behind the
e2ebuild tag;make e2erunsscripts/e2e.sh, which sweeps./internal/e2e/...and./internal/pipeline/steps/..., so keep new step-local e2e tests behind the tag too. - Temporary e2e daemons (
NM_TEST_START_DAEMON=1/ harness) are owned byinternal/e2edaemon: exact inventory, concurrency cap (NM_E2E_DAEMON_MAX, default 2), bounded argv checks, and reapers in harness Cleanup, packageTestMain, andscripts/e2e.shEXIT/INT/TERM. A SIGKILL of the wrapper shell does not run its trap; next-run inventory recovery covers that. External sleep-loop keepalives are out of scope. Never point inventory reaping at the shared~/.no-mistakesservice. Regressions:internal/e2edaemon/*_test.go. - Packages whose tests shell out to git unset
GIT_CONFIG_COUNTinTestMainso ambientGIT_CONFIG_*injection from agent harnesses cannot leak in; a test exercising injected config re-sets it witht.Setenv(seeinternal/git,internal/gate,internal/daemon,internal/pipeline/steps,internal/pipeline/steps/citest). - Those
TestMains (plusinternal/evidence,internal/branchsync,internal/gatecontext) also setGIT_CONFIG_NOSYSTEM=1: some distributions shipsafe.bareRepository=explicitin the system git config, which refuses running git inside the bare fixture repositories. Production code passes--git-dirfor bare repositories and must keep working without this. - Every package whose tests run git also points
GIT_CONFIG_GLOBALat a nonexistent path in a temp directory (write no file), so fixture commits never follow the developer'scommit.gpgsign. AHOMEoverride alone does not isolate it, because git also reads$XDG_CONFIG_HOME/git/config. A test that needs a global config writes its own file and re-setsGIT_CONFIG_GLOBALwitht.Setenv(seeTestCIStep_CommitAndPush_GitCommandsUseStandardCredentialEnv). - Packages whose tests can start a daemon or touch ambient state (
cmd/no-mistakes,internal/cli,internal/update) use a package-wideTestMainthat pointsNM_HOMEandHOMEat fresh temp dirs and disables telemetry/update-check env vars, so a full test run never touches a real~/.no-mistakes. Follow the same pattern in new such packages. paths.New()refuses the default~/.no-mistakesroot undergo test; tests that touch app state must setNM_HOMEto a temp dir, and only the production-default path test may opt in withNO_MISTAKES_ALLOW_DEFAULT_ROOT_IN_TESTS=1.- Isolate filesystem and environment state with
t.TempDir()andt.Setenv(). - The Windows CI leg is process-spawn bound, not compute bound: git-backed packages cost roughly 10x their Linux time (
internal/git5.7s -> 53s,internal/branchsync31s -> 415s). The Windows matrix has five shard kinds so each job's wall stays insidetimeout-minutes: 40and a hang still surfaces asgo test -timeout(15m) rather than an evidence-free job cancel:windows-steps-Nruns./internal/pipeline/steps/...alone (includingsteps/citest),windows-daemon-Nruns./internal/daemon, andwindows-gate-Nruns./internal/gate, each split by test name (-run/-skipregex on the top-level test name; the last row of a group skips the union of the others so a new test always lands in exactly one row — rebalance the ranges from the rows'-vtimings; steps grew back to the 15m timeout in issue #1580, daemon/gate in #1682),windows-gitruns the remaining git-heavy packages (internal/git,internal/branchsync,internal/evidence,internal/eval), andwindows-coreis thego listremainder filtered byNM_CI_WINDOWS_GIT_EXCLUDE(the union of the other four shards). Combining those packages madewindows-gita serial floor past 15m; the split is the lockstep pin inTestCIWorkflow_WindowsHangSurfacesAsGoTimeoutNotJobCancellation, andTestCIWorkflow_WindowsStepsShardsRunEveryTestExactlyOnce/TestCIWorkflow_WindowsDaemonShardsRunEveryTestExactlyOnce/TestCIWorkflow_WindowsGateShardsRunEveryTestExactlyOncefail when a declared test or a first-character probe name runs in zero rows or in more than one. Keep long git-heavy packages off the serial critical path (internal/branchsyncrunst.Parallel()for exactly that reason) and keep the Defender scan-exclusion step inci.yml, whose comment owns the rationale. GitHub-hosted Windows runners are 4-core; do not assume larger machines. Regressions:TestCIWorkflow_WindowsTestsRunWithScanExclusions,TestCIWorkflow_WindowsHangSurfacesAsGoTimeoutNotJobCancellation,TestCIWorkflow_WindowsStepsShardsRunEveryTestExactlyOnce, `TestCIWorkflow_WindowsDaemonShardsRunEveryTestExa
Установить testing-conventions в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл testing-conventions?
Use when adding or changing tests, the e2e harness, fake CLIs in pipeline-step tests, test process isolation, or CI test sharding.
Как установить скилл testing-conventions?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testing-conventions запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic