CLI Commands
Complete command-line interface reference for MCP Jest.
Basic Usage
mcp-jest [testfile] [options]
Global Options
--version
, -v
Display version information
mcp-jest --version
--help
, -h
Show help information
mcp-jest --help
--timeout <ms>
Set global timeout for all tests
mcp-jest test.json --timeout 30000
--verbose
Enable verbose output for debugging
mcp-jest test.json --verbose
--watch
, -w
Watch files and re-run tests on changes
mcp-jest test.json --watch
--no-colors
Disable colored output
mcp-jest test.json --no-colors
Snapshot Commands
--update-snapshots
, -u
Update all snapshots
mcp-jest test.json --update-snapshots
--update-snapshots=<name>
Update specific snapshot by test name
mcp-jest test.json --update-snapshots="User profile test"
--snapshot-dir <path>
Specify snapshot directory
mcp-jest test.json --snapshot-dir ./test-snapshots
Test Selection
--grep <pattern>
, -g
Run only tests matching pattern
mcp-jest test.json --grep "user.*profile"
--grep-invert
Run tests NOT matching grep pattern
mcp-jest test.json --grep "slow" --grep-invert
--bail
, -b
Stop on first test failure
mcp-jest test.json --bail
Parallel Execution
--parallel
Enable parallel test execution
mcp-jest test.json --parallel
--max-workers <n>
Set number of worker processes
mcp-jest test.json --parallel --max-workers 4
--no-parallel
Force sequential execution
mcp-jest test.json --no-parallel
Reporting Options
--reporter <name>
Specify test reporter
mcp-jest test.json --reporter junit
--output-file <path>
Write results to file
mcp-jest test.json --reporter junit --output-file results.xml
--silent
Suppress console output
mcp-jest test.json --silent
Configuration Commands
--config <path>
Load configuration from file
mcp-jest test.json --config ./custom-config.json
--validate-config
Validate configuration and exit
mcp-jest --validate-config
--env <name>
Use environment-specific configuration
mcp-jest test.json --env production
Development Commands
--dry-run
Show what tests would run without executing
mcp-jest test.json --dry-run
--debug
Enable debug mode with detailed logging
mcp-jest test.json --debug
--inspect
Enable Node.js inspector for debugging
mcp-jest test.json --inspect
Coverage Commands
--coverage
Enable test coverage reporting
mcp-jest test.json --coverage
--coverage-dir <path>
Specify coverage output directory
mcp-jest test.json --coverage --coverage-dir ./coverage
Common Command Combinations
Development Workflow
mcp-jest tests/*.json --watch --verbose
CI/CD Pipeline
mcp-jest tests/*.json --parallel --bail --no-colors --reporter junit --output-file results.xml
Quick Smoke Test
mcp-jest smoke-test.json --timeout 5000 --bail
Performance Testing
mcp-jest perf-tests.json --timeout 60000 --verbose --no-parallel
Exit Codes
0 - All tests passed
1 - Test failures occurred
2 - Configuration error
3 - Server startup failed
4 - Invalid command line arguments
5 - Snapshot update required
130 - Process interrupted (Ctrl+C)
Shell Completion
Enable tab completion for faster CLI usage:
# Bash
mcp-jest --completion bash >> ~/.bashrc
# Zsh
mcp-jest --completion zsh >> ~/.zshrc
# Fish
mcp-jest --completion fish >> ~/.config/fish/completions/mcp-jest.fish
🚀 CLI Mastery
The MCP Jest CLI is powerful and flexible. Combine options to create the perfect testing workflow.
Explore Test Configuration →