| name | test-running |
| description | Advanced Jest test modes in the Commons monorepo — /local/ tests, watch mode, live console output, multi-file batching, and test-failure troubleshooting. For routine "run the test for this file" resolution, call the nx-project-for-file tool instead. |
Advanced Jest Test Modes
Project + command resolution: Call the nx-project-for-file tool with the test
file path. It returns the owning project, root, and the exact
npx nx test:jest:run <project> -- --runTestsByPath <relative-path> command.
This skill covers only the modes the tool does not emit.
/local/ tests — different target
The tool emits test:jest:run. If the test path contains /local/, swap the target
to test-local:jest:run:
npx nx test-local:jest:run <project> -- --runTestsByPath <relative-path>
| File Path | Target |
|---|
packages/athena/__tests__/local/workflow.spec.ts | test-local:jest:run |
commons-packages/backend/__tests__/services/member.spec.ts | test:jest:run |
Running multiple files (batching)
Same project, same target — pass multiple paths in one invocation:
npx nx test:jest:run @commons/backend -- --runTestsByPath __tests__/a.spec.ts __tests__/b.spec.ts
Running all tests for a project
Omit --runTestsByPath:
npx nx :jest:run @commons/backend