Back to Nx

Jest

packages/jest/PLUGIN.md

22.7.11.1 KB
Original Source

Jest

After making changes to a project, run the relevant test file to verify your changes work correctly.

Mode Detection

Check in order (first match wins):

ModeDetection
Inference@nx/jest/plugin in nx.json plugins array
Executor@nx/jest:jest executor in project.json targets

Run Specific Test File

Inference

bash
nx test <project> -- --testPathPattern=<path/to/file.spec.ts>

Executor

bash
nx run <project>:test --testFile=<path/to/file.spec.ts>

Quick Reference

TaskInferenceExecutor
Run filenx test proj -- --testPathPattern=path/file.spec.tsnx run proj:test --testFile=path/file.spec.ts
Run patternnx test proj -- -t "pattern"nx run proj:test --testNamePattern="pattern"