@magic/test
CLI Flags Reference
Available command-line flags for @magic/test:
Flag Reference Table
| Flag | Aliases | Default | Env Var | Description | Example || :--- | :----- | :-----: | :------ | :---------- | :------ || -p, --production, --prod | | | | Run tests without coverage (faster) | t -p || -l, --verbose, --loud | | | | Show detailed output including passing tests | t -l || -i, --include | | | | Files to include in coverage | t -i "src/*.js" || -e, --exclude | | | | Files to exclude from coverage | t -e "src/test.js" || --shards N | | | | Total number of shards to split tests across | t --shards 4 --shard-id 0 || --shard-id N | | | | Shard ID (0-indexed) to run | t --shards 4 --shard-id 2 || -w, --workers N | | auto | | Max parallel workers (default: auto-detect CPU count) | t -p --workers 2 || --help | | | | Show help text | t --help || --trace | | | MAGIC_TEST_TRACE | Enable timing traces for performance debugging | t --trace |
Flag Notes
- --shards and --shard-id must be used together
- --shard-id is 0-indexed (0 to N-1)
- Use -p flag for faster development runs (no coverage)
- --workers controls parallel test execution
Example Usage
Basic Test Run
npm test # runs with coveragenpm test # runs without coverage (faster)
Shard Large Test Suite
# Run 4 shards, this is shard 0 (of 0-3)t --shards 4 --shard-id 0# Run shard 1t --shards 4 --shard-id 1# Combine with other flagst -p --shards 4 --shard-id 2 --workers 2
See Also
- CLI & Usage - detailed usage guide
- Performance Tips - optimization techniques
- CLI Sharding Cheat-Sheet - CI/CD examples