From 92e0aa02e76351c0b47007f783d98f2dd92e53c6 Mon Sep 17 00:00:00 2001 From: bcoe Date: Sat, 1 Feb 2020 14:09:55 -0800 Subject: [PATCH 1/6] docs: document Node.js' --enable-source-maps flag --- docs/index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/index.md b/docs/index.md index 7f44f34acc..9194813bf1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,6 +36,8 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in - [auto-exit to prevent "hanging" with an active loop](#-exit) - [easily meta-generate suites](#markdown) & [test-cases](#list) - [config file support](#-config-path) +- [mocha.opts file support](#-opts-path) +- [source-map support](#-enable-source-maps) - clickable suite titles to filter test execution - [node debugger support](#-inspect-inspect-brk-inspect) - [node native ES modules support](#nodejs-native-esm-support) @@ -963,6 +965,19 @@ Specify an explicit path to a [`package.json` file](#configuring-mocha-nodejs) ( By default, Mocha looks for a `package.json` in the current working directory or nearest ancestor, and will use the first file found (regardless of whether it contains a `mocha` property); to suppress `package.json` lookup, use `--no-package`. +### `--enable-source-maps` + +> _New in Node.js v12.12.0_ + +If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag +is passed to Node.js, source-maps will be collected and used to provide acurate stack traces for transpiled code: + +```bash +Error: cool + at Object. (/Users/fake-user/bigco/nodejs-tasks/build/src/index.js:27:7) + -> /Users/fake-user/bigco/nodejs-tasks/src/index.ts:24:7 +``` + ### `--extension ` Files having this extension will be considered test files. Defaults to `js`. From 99b62c64cc68d23804f8eb8e3e2f0c953604dfb5 Mon Sep 17 00:00:00 2001 From: bcoe Date: Sat, 1 Feb 2020 14:13:25 -0800 Subject: [PATCH 2/6] chore: fix anchor link --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 9194813bf1..525ae66b47 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,7 +37,7 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in - [easily meta-generate suites](#markdown) & [test-cases](#list) - [config file support](#-config-path) - [mocha.opts file support](#-opts-path) -- [source-map support](#-enable-source-maps) +- [source-map support](#--enable-source-maps) - clickable suite titles to filter test execution - [node debugger support](#-inspect-inspect-brk-inspect) - [node native ES modules support](#nodejs-native-esm-support) From e3bd1d35d0068d284bd3d29b1665a3ba47e81832 Mon Sep 17 00:00:00 2001 From: bcoe Date: Sat, 1 Feb 2020 14:15:12 -0800 Subject: [PATCH 3/6] chore: fix typo --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 525ae66b47..b553e34904 100644 --- a/docs/index.md +++ b/docs/index.md @@ -970,7 +970,7 @@ By default, Mocha looks for a `package.json` in the current working directory or > _New in Node.js v12.12.0_ If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag -is passed to Node.js, source-maps will be collected and used to provide acurate stack traces for transpiled code: +is passed to Node.js, source-maps will be collected and used to provide accurate stack traces for transpiled code: ```bash Error: cool From 458cdcf7a97db867c7f867bfc680e7944882954a Mon Sep 17 00:00:00 2001 From: bcoe Date: Mon, 23 Mar 2020 21:49:46 -0700 Subject: [PATCH 4/6] chore: address code review --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index b553e34904..3d5080f447 100644 --- a/docs/index.md +++ b/docs/index.md @@ -970,7 +970,7 @@ By default, Mocha looks for a `package.json` in the current working directory or > _New in Node.js v12.12.0_ If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag -is passed to Node.js, source-maps will be collected and used to provide accurate stack traces for transpiled code: +is passed to mocha, source maps will be collected and used to provide accurate stack traces for transpiled code: ```bash Error: cool From 0d5cead39a01466647fa7e6d17bf9160146628a3 Mon Sep 17 00:00:00 2001 From: bcoe Date: Mon, 23 Mar 2020 21:54:34 -0700 Subject: [PATCH 5/6] chore: fix up merge conflict --- docs/index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 3d5080f447..b6ab1b4cdd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,7 +36,6 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in - [auto-exit to prevent "hanging" with an active loop](#-exit) - [easily meta-generate suites](#markdown) & [test-cases](#list) - [config file support](#-config-path) -- [mocha.opts file support](#-opts-path) - [source-map support](#--enable-source-maps) - clickable suite titles to filter test execution - [node debugger support](#-inspect-inspect-brk-inspect) From edb8e6b76b64bfafbc198fba6ab83f42b6efda35 Mon Sep 17 00:00:00 2001 From: bcoe Date: Wed, 20 May 2020 20:29:48 -0700 Subject: [PATCH 6/6] docs: address review --- docs/index.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/index.md b/docs/index.md index b6ab1b4cdd..44d61519d2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,10 +36,10 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in - [auto-exit to prevent "hanging" with an active loop](#-exit) - [easily meta-generate suites](#markdown) & [test-cases](#list) - [config file support](#-config-path) -- [source-map support](#--enable-source-maps) - clickable suite titles to filter test execution - [node debugger support](#-inspect-inspect-brk-inspect) - [node native ES modules support](#nodejs-native-esm-support) +- [source-map support](#-enable-source-maps) - [detects multiple calls to `done()`](#detects-multiple-calls-to-done) - [use any assertion library you want](#assertions) - [extensible reporting, bundled with 9+ reporters](#reporters) @@ -964,19 +964,6 @@ Specify an explicit path to a [`package.json` file](#configuring-mocha-nodejs) ( By default, Mocha looks for a `package.json` in the current working directory or nearest ancestor, and will use the first file found (regardless of whether it contains a `mocha` property); to suppress `package.json` lookup, use `--no-package`. -### `--enable-source-maps` - -> _New in Node.js v12.12.0_ - -If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag -is passed to mocha, source maps will be collected and used to provide accurate stack traces for transpiled code: - -```bash -Error: cool - at Object. (/Users/fake-user/bigco/nodejs-tasks/build/src/index.js:27:7) - -> /Users/fake-user/bigco/nodejs-tasks/src/index.ts:24:7 -``` - ### `--extension ` Files having this extension will be considered test files. Defaults to `js`. @@ -1128,6 +1115,19 @@ These flags vary depending on your version of Node.js. `node` flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs). +### `--enable-source-maps` + +> _New in Node.js v12.12.0_ + +If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag +is passed to mocha, source maps will be collected and used to provide accurate stack traces for transpiled code: + +```bash +Error: cool + at Object. (/Users/fake-user/bigco/nodejs-tasks/build/src/index.js:27:7) + -> /Users/fake-user/bigco/nodejs-tasks/src/index.ts:24:7 +``` + ### About V8 Flags Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excluding `--v8-options` itself) to use it.