2025-03-14 21:59:59 -06:00
|
|
|
# mocha
|
|
|
|
|
|
|
|
|
|
> A feature-rich JavaScript test framework.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://mochajs.org/#command-line-usage>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run tests with default configuration or as configured in `mocha.opts`:
|
|
|
|
|
|
|
|
|
|
`mocha`
|
|
|
|
|
|
|
|
|
|
- Run tests contained at a specific location:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`mocha {{path/to/test_directory}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run tests that match a specific `grep` pattern:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`mocha {{[-g|--grep]}} {{regex}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run tests on changes to JavaScript files in the current directory and once initially:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`mocha {{[-w|--watch]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run tests with a specific reporter:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`mocha {{[-R|--reporter]}} {{reporter}}`
|