HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

mocha — A feature-rich JavaScript test framework. More information: <https://mochajs.org/#command-line-usage

Submitted by: @import:tldr-pages··
0
Viewed 0 times
featurecommandrichjavascriptframeworkmochaclitest

Problem

How to use the mocha command: A feature-rich JavaScript test framework. More information: <https://mochajs.org/#command-line-usage>.

Solution

mocha — A feature-rich JavaScript test framework. More information: <https://mochajs.org/#command-line-usage>.

Run tests with default configuration or as configured in mocha.opts:
mocha


Run tests contained at a specific location:
mocha {{path/to/test_directory}}


Run tests that match a specific grep pattern:
mocha {{[-g|--grep]}} {{regex}}


Run tests on changes to JavaScript files in the current directory and once initially:
mocha {{[-w|--watch]}}


Run tests with a specific reporter:
mocha {{[-R|--reporter]}} {{reporter}}

Code Snippets

Run tests with default configuration or as configured in `mocha.opts`

mocha

Run tests contained at a specific location

mocha {{path/to/test_directory}}

Run tests that match a specific `grep` pattern

mocha {{[-g|--grep]}} {{regex}}

Run tests on changes to JavaScript files in the current directory and once initially

mocha {{[-w|--watch]}}

Run tests with a specific reporter

mocha {{[-R|--reporter]}} {{reporter}}

Context

tldr-pages: common/mocha

Revisions (0)

No revisions yet.