Command-line options
Overview
The Nightwatch test runner supports a number of run-time options to be passed to. To view all, run the following:
nightwatch --help
Options
Name | Shortname | default | description |
---|---|---|---|
Main options | |||
--env |
-e |
default |
Which testing environment to use - defined in nightwatch.json |
--config |
-c |
./nightwatch.json |
Path to configuration file; `nightwatch.conf.js` or `nightwatch.json` are read by default if present. Check the [Configuration](/gettingstarted/configuration/) section. |
--test |
-t |
Runs only the specified test suite/module. By default the runner will attempt to run all tests in the src_folders settings folder(s) and their subfolders. |
|
--testcase |
Used only together with `--test`. Runs the specified testcase from the current suite/module. | ||
--mocha |
Set the test runner to use Mocha. | ||
--timeout |
Set the global timeout for assertion retries before an assertion fails. The various timeout values are defined in the [Globals](/gettingstarted/concepts/#using-test-globals) section. | ||
--reuse-browser |
Use the same browser session to run the individual test suites (serial mode only). | ||
--workers |
Max number of test files running at the same time (default: CPU cores; e.g. workers=4) | ||
--serial |
Executes tests serially (disables parallel mode). | ||
--headless |
Launch the browser (Chrome or Firefox) in headless mode. | ||
--devtools |
Automatically open devtools when launching the browser (Chrome, Edge, or Safari). | ||
--verbose |
|
Shows extended selenium command logging during the session. | |
--fail-fast |
Run in "fail-fast" mode: if a test suite cannot be started, the rest will be aborted. | ||
--list-files |
Shows list of files present in the project. | ||
Tags & filtering | |||
--group |
-g |
Runs only the specified group or several (comma separated) of tests (subfolder). Tests are grouped by being placed in the same subfolder. | |
--skipgroup |
-s |
Skip one or several (comma separated) group of tests. | |
--filter |
-f |
Specify a filter (glob expression) as the file name format to use when loading the test files. | |
--tag |
-a |
Filter test modules by tags. Only tests that have the specified tags will be loaded. | |
--skiptags |
Skips tests that have the specified tag or tags (comma separated). | ||
Retrying | |||
--retries |
Retries failed or errored testcases up to the specified number of times. Retrying a testcase will also retry the `beforeEach` and `afterEach` hooks, if any. | ||
--suiteRetries |
Retries failed or errored testsuites (test modules) up to the specified number of times. Retrying a testsuite will also retry the `before` and `after` hooks (in addition to the global beforeEach and afterEach respectively), if any are defined on the testsuite. | ||
Reporting | |||
--reporter |
-r |
junit |
Name of a predefined reporter (e.g. junit) or path to a custom reporter file to use. The custom reporter interface looks like:
|
--output |
-o |
tests_output |
The location where the JUnit XML reports will be saved. |
--open |
|
Opens the HTML report generated in the default browser at the end of test run | |
Component Testing | |||
--debug |
|
Automatically pause the test execution after mounting the component and open the Nightwatch debug REPL interface. | |
--story |
|
Allows to specify which story to run from the current file (when using Storybook or JSX written in component story format). | |
--preview |
|
Used to preview a component story/test; automatically pause the test execution after mounting the component. | |
Info & Help | |||
--help |
-h |
Shows this help. | |
--version |
-v |
Shows the version number |