From fd95c88699c0668de7bab517bbf644543de2d621 Mon Sep 17 00:00:00 2001 From: juergba Date: Mon, 19 Jul 2021 18:16:17 +0200 Subject: [PATCH] docs --- docs/index.md | 19 ++++++++++++++----- example/config/.mocharc.js | 1 + example/config/.mocharc.yml | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/index.md b/docs/index.md index 12b4b18955..3e1fce6ed3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -876,9 +876,7 @@ Use this option to have Mocha check for global variables that are leaked while r ### `--dry-run` -> _New in v9.0.0._ - -Report tests without executing any of them, neither tests nor hooks. +> _New in v9.0.0._ Report tests without executing any of them, neither tests nor hooks. ### `--exit` @@ -1015,6 +1013,15 @@ Specify an explicit path to a [configuration file](#configuring-mocha-nodejs). By default, Mocha will search for a config file if `--config` is not specified; use `--no-config` to suppress this behavior. +### `--node-option , -n ` + +> _New in v9.1.0._ + +For Node.js and V8 options. Mocha forwards these options to Node.js by spawning a new child-process.
+e.g. `-n require=foo -n unhandled-rejections=strict` + +Can also be specified as a comma-delimited list: `-n "require=foo, unhandled-rejections=strict"` + ### `--opts ` > _Removed in v8.0.0. Please use [configuration file](#configuring-mocha-nodejs) instead._ @@ -1159,8 +1166,6 @@ Requires either `--grep` or `--fgrep` (but not both). ### `--inspect, --inspect-brk, inspect` -> _BREAKING CHANGE in v7.0.0; `--debug` / `--debug-brk` are removed and `debug` is deprecated._ - Enables Node.js' inspector. Use `--inspect` / `--inspect-brk` to launch the V8 inspector for use with Chrome Dev Tools. @@ -1209,6 +1214,8 @@ These flags vary depending on your version of Node.js. `node` flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs). +> _New in v9.1.0._ You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name). + ### `--enable-source-maps` > _New in Node.js v12.12.0_ @@ -1228,6 +1235,8 @@ Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excludi V8 flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs). +> _New in v9.1.0._ You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name). + ## Parallel Tests > _New in v.8.0.0._ diff --git a/example/config/.mocharc.js b/example/config/.mocharc.js index 235f6e0b86..bdd89e769f 100644 --- a/example/config/.mocharc.js +++ b/example/config/.mocharc.js @@ -26,6 +26,7 @@ module.exports = { 'inline-diffs': false, // invert: false, // needs to be used with grep or fgrep jobs: 1, + 'node-option': ['unhandled-rejections=strict'], // without leading "--", also V8 flags package: './package.json', parallel: false, recursive: false, diff --git a/example/config/.mocharc.yml b/example/config/.mocharc.yml index 0172f7cd40..4ba30dff22 100644 --- a/example/config/.mocharc.yml +++ b/example/config/.mocharc.yml @@ -29,6 +29,8 @@ inline-diffs: false # needs to be used with grep or fgrep # invert: false jobs: 1 +node-option: + - 'unhandled-rejections=strict' # without leading "--", also V8 flags package: './package.json' parallel: false recursive: false