npx claudepluginhub pjt222/agent-almanacThis skill uses the workspace's default tool permissions.
---
Test-driven development workflow for R using testthat. Use when writing new features, fixing bugs, or refactoring code. Enforces test-first development with 80%+ coverage.
Runs test suites for RSpec, Minitest, Jest/Vitest, pytest, and Go tests, returning structured pass/fail results with failure details. Supports scoped runs by directory, file, or test name pattern.
Share bugs, ideas, or general feedback.
Run the jigsawR test suite and interpret results.
full, filtered, or single)"snic", "rectangular")| Scope | Use when | Duration |
|---|---|---|
| Full | Before commits, after major changes | ~2-5 min |
| Filtered | Working on one puzzle type | ~30s |
| Single | Debugging a specific test file | ~10s |
Expected: Test scope selected based on current workflow: full suite before commits, filtered when working on a specific puzzle type, single file when debugging one test.
On failure: If unsure which scope to use, default to full suite. It takes longer but catches cross-type regressions.
Full suite:
Create a script file (e.g., /tmp/run_tests.R):
devtools::test()
R_EXE="/mnt/c/Program Files/R/R-4.5.0/bin/Rscript.exe"
cd /mnt/d/dev/p/jigsawR && "$R_EXE" -e "devtools::test()"
Filtered by pattern:
"$R_EXE" -e "devtools::test(filter = 'snic')"
Single file:
"$R_EXE" -e "testthat::test_file('tests/testthat/test-snic-puzzles.R')"
Expected: Test output with pass/fail/skip counts.
On failure:
--vanilla flag; renv needs .Rprofile to activaterenv::restore() firstLook for the summary line:
[ FAIL 0 | WARN 0 | SKIP 7 | PASS 2042 ]
snic)Expected: The summary line parsed to identify PASS, FAIL, SKIP, and WARN counts. FAIL = 0 for a clean test run.
On failure: If the summary line is not visible, the test runner may have crashed before completing. Check for R-level errors above the summary. If output is truncated, redirect to a file: "$R_EXE" -e "devtools::test()" > test_results.txt 2>&1.
If tests fail:
# Run just the failing test with verbose output
"$R_EXE" -e "testthat::test_file('tests/testthat/test-failing.R', reporter = 'summary')"
Expected: Root cause of each failing test identified. The failure is either a genuine regression (code needs fixing) or a test environment issue (missing dependency, path problem).
On failure: If the failure message is unclear, add browser() or print() statements to the test and re-run with testthat::test_file() for interactive debugging.
Skipped tests are normal when optional dependencies are missing:
snic package tests skip with skip_if_not_installed("snic")skip_on_os()skip_on_cran()Confirm skip reasons are legitimate, not masking real failures.
Expected: All skips are accounted for by legitimate reasons (optional dependency not installed, platform-specific skip, CRAN-only skip). No skips are masking actual test failures.
On failure: If a skip seems suspicious, temporarily remove the skip_if_*() call and run the test to see if it passes or reveals a hidden failure.
--vanilla: Breaks renv activation. Never use it with jigsawR.-e strings: Shell escaping issues cause Exit code 5. Use script files.devtools::load_all() or devtools::document() before testing if you changed NAMESPACE-affecting code.DESCRIPTION Suggests field.testthat::test_file().generate-puzzle — generate puzzles to verify behavior matches testsadd-puzzle-type — new types need comprehensive test suiteswrite-testthat-tests — general patterns for writing R testsvalidate-piles-notation — test PILES parsing independently