Run Grove tests and diagnose failures. Use when the user asks to "run the tests", "run my test", "debug this test failure", "why is this test failing", "check if tests pass", or wants to execute and troubleshoot code example tests.
66
79%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./.claude/skills/grove-run/SKILL.mdBegin your first response with: [grove-run-647f2a26]
Run code example tests and provide actionable diagnosis of any failures.
Do NOT use when:
/grove-create or /grove-test/grove-migrate.env file, deps not installed) → use /grove-setup/grove-maintainBefore Step 1, check whether the Grove VS Code extension has dropped a
handoff file at .claude/grove-handoff.json in the workspace root. If the
file exists and skill equals grove-run:
Delete the handoff file immediately after reading it. The file is single-use; leaving it in place causes the next invocation to re-trigger on stale context.
Check the payload before using it. If a check fails, surface what's wrong to the writer, recommend they file an issue for the Grove VS Code extension, and ask whether to proceed without the handoff. If they confirm, fall through to Step 1.
version must equal 1. A higher number means
the extension is ahead of this skill. Example message:
Found a Grove extension handoff with
version: {n}, but this skill only understands version 1. The extension is likely newer than the skill. Proceed without the handoff?
version, skill, trigger, context. The
context object must contain the fields listed in the schema
for the matching trigger below. Example message:
The Grove extension handoff at
.claude/grove-handoff.jsonis malformed: {brief reason, e.g. "missing context.testFile"}. This is likely an extension bug — please file an issue. Proceed without the handoff?
The JSON block below is the expected payload schema, not just an illustrative sample. Use it as the reference for what fields must be present:
{
"version": 1,
"skill": "grove-run",
"trigger": "test-failure",
"timestamp": "ISO-8601",
"workspaceRoot": "/absolute/path",
"context": {
"testFile": "relative/path/to/file.test.ts",
"testName": "describe > it text",
"testNamePattern": "describe it text",
"line": 42,
"errorMessage": "captured failure output (may be truncated)",
"duration": 1234,
"projectPath": "code-example-tests/javascript/driver"
}
}Treat the context fields as pre-filled answers — skip Step 1
(scope/language) and Step 2 (suite lookup). projectPath is the
driver directory; testFile and testNamePattern are the inputs
for Step 3.
Guard against stale handoffs: verify context.testFile still
exists on disk (the writer may have renamed it or switched branches
between the CodeLens click and skill invocation). If it doesn't
exist, report what was expected, fall through to Step 1, and let
the writer disambiguate.
Echo one line confirming what was received, e.g.:
Got handoff from extension: re-running "{testName}" in {projectPath}.
Proceed to Step 3 to re-run the single failing test (fresh output is
more reliable than the captured errorMessage), then Step 4 to
diagnose. If the re-run now passes, report that and stop.
If the handoff file is absent or skill doesn't match, proceed normally
from Step 1.
Parse the user's request to identify:
If the user provides a path, use it directly. If they say "run the tests" with no qualifier, ask which language/suite or default to running all tests in the language directory they're currently working in.
Map the language to its driver directory under code-example-tests/:
| Suite | Directory | Test command |
|---|---|---|
| JavaScript | javascript/driver/ | npm test (all) or npm test -- -t '{name}' (single) |
| Python | python/pymongo/ | python -m pytest or python -m unittest |
| Go | go/driver/ | go test ./tests/... |
| Java | java/driver-sync/ | mvn test |
| C# | csharp/driver/ | dotnet test |
| Mongosh | command-line/mongosh/ | npm test (all) or npm test -- -t '{name}' (single) |
Read the language's CLAUDE.md for the exact commands and any env setup needed.
This is the canonical source for test commands. Other grove skills reference these patterns — keep them up to date here.
For JavaScript and Mongosh (Jest-based suites):
All tests:
cd code-example-tests/{driver-dir} && npm testSingle test by name:
cd code-example-tests/{driver-dir} && npm test -- -t '{describe or it text}'npm test handles .env loading and Jest flags (--runInBand,
--detectOpenHandles) via the scripts.test entry in package.json. Do not
call npx jest directly — use npm test -- to pass arguments through.
Capture the full output including any error messages, stack traces, and test result summary.
If all tests pass, report the summary and stop.
If any tests fail, for each failure:
MongoServerSelectionError, ECONNREFUSED, timeout on connect.env exists with CONNECTION_STRING. Verify the
connection string format. Suggest creating/updating the .env file.ComparisonResult failure, "expected X but received Y", diff outputwithIgnoredFields(...) for dynamic field values (e.g., _id, timestamps)withUnorderedSort() if order differs but content is correctshouldResemble().withSchema(...) for highly variable output
See the "Comparison API" section in the target language's conventions file
for the full Expect API method signatures and ellipsis pattern reference.describeWithSampleData() or itWithSampleData() if not already.Exceeded timeout of 120000 ms, test hangsclient.close() in the example's finally
block. Check for unclosed cursors or change streams. For JavaScript/Node.js,
also check for missing await on async operations — a missing await
can cause the test to hang without an obvious error. If the operation is
expected to be slow (full-collection scan, multi-stage aggregation, or
processing more than 10,000 documents), increase the specific test's
timeout to 240000 ms via it('...', async () => {...}, 240000). Do not
increase the global timeout in jest.config.cjs.Cannot find module, SyntaxError: Cannot use import,
does not provide an export namedTypeError, ReferenceError, MongoDB operation errorsFor each diagnosed failure:
Present the diagnosis clearly: what failed, why, and what to change
Propose a specific fix with the exact code change
Ask for approval before making changes, unless the fix is adding an
Expect chain modifier for dynamic fields or sort order (e.g.,
withIgnoredFields, withUnorderedSort) — these can be applied directly,
then re-run to confirm. See the "Comparison API" section in the target
language's conventions file.
Do not auto-update expected output files without asking. An output mismatch may indicate an idempotency issue (stale state between runs) or a logic bug, not just a stale output file. Investigate the cause first.
After applying fixes, re-run the failing test to confirm the fix works.
Provide a summary headed with Skill: grove-run:
client.close(), an
unclosed change stream/cursor, or (in Node.js) a missing await. Check
the example's finally/defer block first, then check for unawaited async
calls./grove-setup to check sample data availability.dropDatabase privileges) and incomplete state
cleanup between tests (e.g., test A's teardown doesn't clean up what test
B expects). Teardown errors with ns not found or similar "doesn't exist"
messages are generally safe to ignore, but other teardown failures
(permissions, timeouts, connection errors) should be diagnosed and fixed.5985af5
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.