Issue to Regression Test
This skill automates the workflow of fixing a bug reported via a GitHub issue by creating a regression test first.
Workflow
Scaffold the Regression Test:
- If an issue number is provided, use the bundled Node.js script to scaffold the test file.
- Command:
node .agents/skills/issue-to-regression-test/scripts/scaffold-test.js <issue_number> - This script will automatically fetch issue details using
ghand create a file insrc/tests/with the correct JSDoc header.
Refine and Reproduce the Bug:
- Open the newly created test file in
src/tests/. - Implement a test case that fails when run against the current codebase.
- The test should accurately reflect the bug described in the issue.
- Use
vitestfor testing. Importdescribe,expect,itfromvitest. - Import necessary modules from
src/to test the failing behavior.
- Open the newly created test file in
Fix the Bug:
- Modify the source code in the
src/directory to fix the reported bug. - Aim for a surgical fix that solves the problem without unnecessary refactoring.
- Modify the source code in the
Verify Fix and Prevent Regressions:
- Ensure the new test passes.
- Run ALL tests in the project to ensure no regressions were introduced.
- Command:
npx vitest run
Example JSDoc
/**
* Regression test for issue #2: Visibility settings from template are not respected
* https://github.com/brunosabot/streamline-card/issues/2
*
* Bug: When configuring visibility in a template, the card would always be visible
* instead of respecting the visibility conditions.
*
* Expected: Visibility settings from templates should be properly applied to the card
*/
Source: brunosabot/streamline-card — distributed by TomeVault.