Agent skill
test-running
Run Jest tests in the Commons monorepo. Use when testing code changes, validating implementations, debugging test failures, or when the user mentions running tests.
Install this agent skill to your Project
npx add-skill https://github.com/jakewaldrip/.dotfiles/tree/main/misc/commons/.opencode/skills/test-running
SKILL.md
Run Jest Tests
Quick Reference
npx nx <target> <project> -- --runTestsByPath <relative-path>
| Component | How to Determine |
|---|---|
<target> |
test-local:jest:run if path contains /local/, otherwise test:jest:run |
<project> |
Use @nx-project-mapping skill to get project name |
<relative-path> |
Path relative to project root, not repo root |
Workflow
- Use @nx-project-mapping to get the project name and root
- Strip the project root prefix from the file path to get the relative path
- Choose target:
test-local:jest:runfor/local/paths,test:jest:runotherwise - Run the command
Examples
| File Path | Project | Relative Path | Command |
|---|---|---|---|
commons-packages/backend/__tests__/services/member.spec.ts |
@commons/backend |
__tests__/services/member.spec.ts |
npx nx test:jest:run @commons/backend -- --runTestsByPath __tests__/services/member.spec.ts |
packages/athena/__tests__/local/workflow.spec.ts |
@cityblock/athena |
__tests__/local/workflow.spec.ts |
npx nx test-local:jest:run @cityblock/athena -- --runTestsByPath __tests__/local/workflow.spec.ts |
Running Multiple Files
Same project, same target—pass multiple paths:
npx nx test:jest:run @commons/backend -- --runTestsByPath __tests__/a.spec.ts __tests__/b.spec.ts
Running All Tests for a Project
Omit --runTestsByPath to run all tests:
npx nx test:jest:run @commons/backend
Console Output (Debugging)
By default, console output is captured and only shown on failure. For live output:
COMMONS_TESTING_LOG_LEVEL=live npx nx test:jest:run <project> -- --runTestsByPath <path>
Log levels: error (default) | warn | info | live
Watch Mode
For development, add --watch:
npx nx test:jest:run @commons/backend -- --runTestsByPath __tests__/my.spec.ts --watch
Troubleshooting
| Issue | Solution |
|---|---|
| EPERM errors | Run with sandbox disabled (permission issues with npm/node modules) |
| Test not found | Verify path is relative to project root, not repo root |
/local/ tests not running |
Use test-local:jest:run target instead of test:jest:run |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
react-component-writing
React component patterns and style guide for the Commons monorepo. Use when creating React components, working with GraphQL in components, or implementing internationalization with MessageFormat.
graphite-cli
Use Graphite CLI (gt) for stacked PRs and branch management. Use when creating branches, committing changes, submitting PRs, syncing with trunk, or managing stacked pull requests.
document-type-adding
Add new document types to the DocuSign integration in the Commons monorepo. Use when the user wants to add a patient document, consent form, or agreement to the DocuSign workflow.
dataloader-dual-mode-migration
Migrate dataloaders to dual-mode pattern supporting both patientId and enrollmentId for Member Model 2.0. Use when converting a patient-based dataloader to support the MemberModelV2Switch.
feature-flag-create-or-remove
Create or remove feature flags in the Commons application. Use when the user wants to add a new feature flag, delete a feature flag, or asks about feature flag naming conventions.
nx-project-mapping
Maps file paths to Nx project names in the Commons monorepo. Use when you need to determine which Nx project a file belongs to for running tests, linting, or other Nx commands.
Didn't find tool you were looking for?