Skip to content

Commit

Permalink
fix broken docs
Browse files Browse the repository at this point in the history
- strip ansi stuff
- fix old content terminator
  • Loading branch information
boneskull committed Dec 11, 2018
1 parent f9a6f9b commit 9b7a282
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 65 deletions.
114 changes: 58 additions & 56 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,85 +815,87 @@ Mocha supports the `err.expected` and `err.actual` properties of any thrown `Ass
<!-- AUTO-GENERATED-CONTENT:START (usage:executable=bin/mocha) -->

```plain
mocha [spec..]
Run tests with Mocha
Commands
mocha debug [spec..] Run tests with Mocha [default]
mocha init <path> create a client-side Mocha setup at <path>
mocha debug [spec..] Run tests with Mocha [default]
mocha init <path> create a client-side Mocha setup at <path>
Rules & Behavior
--allow-uncaught Allow uncaught errors to propagate [boolean]
--async-only, -A Require all tests to use a callback (async) or
return a Promise [boolean]
--bail, -b Abort ("bail") after first test failure [boolean]
--check-leaks Check for global variable leaks [boolean]
--delay Delay initial execution of root suite
--exit Force Mocha to quit after tests complete [boolean]
--forbid-only Fail if exclusive test(s) encountered [boolean]
--forbid-pending Fail if pending test(s) encountered [boolean]
--global, --globals List of allowed global variables [array]
--retries Retry failed tests this many times [number]
--slow, -s Specify "slow" test threshold (in milliseconds)
[number] [default: 75]
--timeout, -t, --timeouts Specify test timeout threshold (in milliseconds)
[number] [default: 2000]
--ui, -u Specify user interface [string] [default: "bdd"]
--allow-uncaught Allow uncaught errors to propagate [boolean]
--async-only, -A Require all tests to use a callback (async) or
return a Promise [boolean]
--bail, -b Abort ("bail") after first test failure [boolean]
--check-leaks Check for global variable leaks [boolean]
--delay Delay initial execution of root suite
--exit Force Mocha to quit after tests complete [boolean]
--forbid-only Fail if exclusive test(s) encountered [boolean]
--forbid-pending Fail if pending test(s) encountered [boolean]
--global, --globals List of allowed global variables [array]
--retries Retry failed tests this many times [number]
--slow, -s Specify "slow" test threshold (in milliseconds)
[number] [default: 75]
--timeout, -t, --timeouts Specify test timeout threshold (in milliseconds)
[number] [default: 2000]
--ui, -u Specify user interface [string] [default: "bdd"]
Reporting & Output
--color, -c, --colors Force-enable color output [boolean]
--diff Show diff on failure
[boolean] [default: true]
--full-trace Display full stack traces [boolean]
--growl, -G Enable Growl notifications [boolean]
--inline-diffs Display actual/expected differences
inline within each string [boolean]
--reporter, -R Specify reporter to use
[string] [default: "spec"]
--reporter-option, --reporter-options, Reporter-specific options
-O (<k=v,[k1=v1,..]>) [array]
--color, -c, --colors Force-enable color output [boolean]
--diff Show diff on failure
[boolean] [default: true]
--full-trace Display full stack traces [boolean]
--growl, -G Enable Growl notifications [boolean]
--inline-diffs Display actual/expected differences
inline within each string [boolean]
--reporter, -R Specify reporter to use
[string] [default: "spec"]
--reporter-option, --reporter-options, Reporter-specific options
-O (<k=v,[k1=v1,..]>) [array]
Configuration
--config Path to config file [default: (nearest rc file)]
--opts Path to `mocha.opts` [string] [default: "./test/mocha.opts"]
--package Path to package.json for config [string]
--config Path to config file [default: (nearest rc file)]
--opts Path to `mocha.opts` [string] [default: "./test/mocha.opts"]
--package Path to package.json for config [string]
File Handling
--exclude Ignore file(s) or glob pattern(s)
[array] [default: (none)]
--extension, --watch-extensions File extension(s) to load and/or watch
[array] [default: js]
--file Specify file(s) to be loaded prior to root
suite execution [array] [default: (none)]
--recursive Look for tests in subdirectories [boolean]
--require, -r Require module [array] [default: (none)]
--sort, -S Sort test files
--watch, -w Watch files in the current working directory
for changes [boolean]
--exclude Ignore file(s) or glob pattern(s)
[array] [default: (none)]
--extension, --watch-extensions File extension(s) to load and/or watch
[array] [default: js]
--file Specify file(s) to be loaded prior to root
suite execution [array] [default: (none)]
--recursive Look for tests in subdirectories [boolean]
--require, -r Require module [array] [default: (none)]
--sort, -S Sort test files
--watch, -w Watch files in the current working directory
for changes [boolean]
Test Filters
--fgrep, -f Only run tests containing this string [string]
--grep, -g Only run tests matching this string or regexp [string]
--invert, -i Inverts --grep and --fgrep matches [boolean]
--fgrep, -f Only run tests containing this string [string]
--grep, -g Only run tests matching this string or regexp [string]
--invert, -i Inverts --grep and --fgrep matches [boolean]
Positional Arguments
spec One or more files, directories, or globs to test
[array] [default: ["test/"]]
spec One or more files, directories, or globs to test
[array] [default: ["test/"]]
Other Options
--help, -h Show usage information & exit [boolean]
--version, -V Show version number & exit [boolean]
--interfaces List built-in user interfaces & exit
--reporters List built-in reporters & exit
--help, -h Show usage information & exit [boolean]
--version, -V Show version number & exit [boolean]
--interfaces List built-in user interfaces & exit
--reporters List built-in reporters & exit
Mocha Resources
Chat: https://gitter.im/mochajs/mocha/
GitHub: https://github.com/mochajs/mocha.git
Docs: https://mochajs.org/
Chat: https://gitter.im/mochajs/mocha
GitHub: https://github.com/mochajs/mocha.git
Docs: https://mochajs.org/
```

<!-- usagestop -->
<!-- AUTO-GENERATED-CONTENT:END -->

### `--allow-uncaught`

Expand Down
78 changes: 74 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
"rewiremock": "^3.12.3",
"rimraf": "^2.5.2",
"sinon": "^7.1.1",
"strip-ansi": "^5.0.0",
"svgo": "^0.7.2",
"through2": "^2.0.5",
"unexpected": "^10.39.2",
Expand Down
13 changes: 8 additions & 5 deletions scripts/markdown-magic.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

const {execSync} = require('child_process');
const stripAnsi = require('strip-ansi');
const markdownToc = require('markdown-toc');
const path = require('path');

Expand All @@ -17,11 +18,13 @@ exports.transforms = {
const flag = options.flag || '--help';
const header = options.header || '\n```plain';
const footer = options.footer || '```\n';
const output = String(
execSync(`${process.execPath} ${executable} ${flag} -C`, {
cwd: path.join(__dirname, '..')
})
).trim();
const output = stripAnsi(
String(
execSync(`${process.execPath} ${executable} ${flag}`, {
cwd: path.join(__dirname, '..')
})
).trim()
);
return [header, output, footer].join('\n\n');
},
// we can't use the builtin `TOC` plugin in markdown-magic
Expand Down

0 comments on commit 9b7a282

Please sign in to comment.