Wallaby Testing Skill
Check test status and debug failing tests using Wallaby.js real-time test execution data.
When to Use
- After code changes - Verify tests pass after modifications
- Checking test status - See if any tests are failing
- Debugging failures - Analyze test errors and exceptions
- Inspecting runtime values - Examine variable states during tests
- Understanding coverage - See which code paths tests execute
- Updating snapshots - When snapshot changes are needed
- User mentions "tests", "test status", "run tests", or "Wallaby"
Available Wallaby Tools
Use these tools to gather test information:
| Tool | Purpose |
|---|---|
wallaby_failingTests |
Get all failing tests with errors and stack traces |
wallaby_failingTestsForFile |
Get failing tests for a specific file |
wallaby_allTests |
Get all tests (useful when there are no failures but you need test IDs) |
wallaby_allTestsForFile |
Get tests covering/executing a specific file |
wallaby_failingTestsForFileAndLine |
Get failing tests covering/executing a specific file and line |
wallaby_allTestsForFileAndLine |
Get tests covering a specific line |
wallaby_runtimeValues |
Inspect variable values at a code location |
wallaby_runtimeValuesByTest |
Get runtime values for a specific test |
wallaby_coveredLinesForFile |
Get coverage data for a file |
wallaby_coveredLinesForTest |
Get lines covered by a specific test |
wallaby_testById |
Get detailed test data by ID |
wallaby_updateTestSnapshots |
Update snapshots for a test |
wallaby_updateFileSnapshots |
Update all snapshots in a file |
wallaby_updateProjectSnapshots |
Update all snapshots in the project |
What Inputs These Tools Need
- For file-scoped tools (like
wallaby_failingTestsForFile,wallaby_coveredLinesForFile): pass the workspace-relative file path. - For line-scoped tools (like
wallaby_allTestsForFileAndLine,wallaby_runtimeValues): passfile,line, and the exactlineContentstring from the file. - For test-scoped tools (like
wallaby_testById,wallaby_runtimeValuesByTest,wallaby_coveredLinesForTest): passtestIdfromwallaby_failingTests/wallaby_allTests.
Debugging Workflow
Step 1: Get Failing Tests
Start by retrieving failing test information:
- Use
wallaby_failingTeststo see all failures - Review error messages and stack traces
- Note the test ID for further inspection
If there are no failing tests but the user is asking about test status or coverage, use wallaby_allTests to confirm the current state and to obtain test IDs.
Step 2: Locate Related Code (Optional)
If the error and stack trace from Step 1 don't provide enough context:
- Use
wallaby_coveredLinesForTestwith the test ID - Focus analysis on covered source files
- Identify which code paths are executed
- Skip this step if the failure cause is already clear
Step 3: Inspect Runtime Values (Optional)
Examine variable states at failure points or other points of interest:
- Use
wallaby_runtimeValuesfor specific locations - Use
wallaby_runtimeValuesByTestfor test-specific values - Compare expected vs actual values
- Skip this step if the failure cause is already clear
Step 4: Implement Fix
Based on analysis:
- Identify the root cause
- Make targeted code changes
- Reference runtime values in your explanation
Step 5: Verify Fix
After changes:
- Wallaby re-runs tests automatically
- Use
wallaby_testByIdto confirm test passes - Check no regressions with
wallaby_failingTests
Step 6: Update Snapshots (if needed)
When snapshots need updating:
- Use
wallaby_updateTestSnapshotsfor specific tests - Use
wallaby_updateFileSnapshotsfor all in a file - Use
wallaby_updateProjectSnapshotsonly when many snapshots changed - Verify tests pass after updates
Example: Debugging an Assertion Failure
- Call wallaby_failingTests → Get test ID and error Error shows: "expected 4, got 5" in multiply function
- (Optional) Call wallaby_coveredLinesForTest(testId) → Skip if error is clear
- (Optional) Call wallaby_runtimeValues(file, line, expression) → Skip if cause is obvious
- Analyze: multiply used + instead of *
- Fix: Change + to * in calculator.js
- Call wallaby_failingTests → Confirm no failures remain
Best Practices
- Use Wallaby tools first - They provide real-time data without re-running tests
- Get test IDs early - Many tools require the test ID from initial queries
- Inspect runtime values - More reliable than guessing variable states
- Verify after fixes - Always confirm the test passes before finishing
- Check for regressions - Ensure fixes don't break other tests