# mochadoc

> The dead simple way to create docs from Mocha BDD & TDD, Jasmine and Jest tests

Latest version **0.9.4** (published 2018-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install mochadoc
pnpm add mochadoc
yarn add mochadoc
bun add mochadoc
```

Provides the command `mochadoc`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.4 |
| Published | 2018-01-02 |
| First published | 2017-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Chris Stead |
| Maintainers | cmstead |
| Keywords | mocha, api, documentation, converter, parser |

## Links

- npm: https://www.npmjs.com/package/mochadoc
- Repository: https://github.com/cmstead/mochadoc
- Homepage: https://github.com/cmstead/mochadoc#readme
- Issues: https://github.com/cmstead/mochadoc/issues
- npm.io page: https://npm.io/package/mochadoc

## Dependencies (12)

- [glob](https://npm.io/package/glob.md) ^7.1.2
- [chalk](https://npm.io/package/chalk.md) ^2.3.0
- [dject](https://npm.io/package/dject.md) ^1.5.0
- [escope](https://npm.io/package/escope.md) ^3.6.0
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [signet](https://npm.io/package/signet.md) ^6.4.2
- [esprima](https://npm.io/package/esprima.md) ^4.0.0
- [inquirer](https://npm.io/package/inquirer.md) ^3.3.0
- [estraverse](https://npm.io/package/estraverse.md) ^4.2.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.11
- [command-line-args](https://npm.io/package/command-line-args.md) ^4.0.7
- [command-line-usage](https://npm.io/package/command-line-usage.md) ^4.0.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.9.4 (latest) — 2018-01-02
- 0.9.3 — 2017-11-14
- 0.9.2 — 2017-11-14
- 0.9.1 — 2017-11-13
- 0.9.0 — 2017-11-13
- 0.8.1 — 2017-11-13
- 0.8.0 — 2017-11-12
- 0.7.1 — 2017-11-12
- 0.7.0 — 2017-11-12
- 0.6.2 — 2017-11-11
- 0.6.1 — 2017-11-10
- 0.6.0 — 2017-11-10
- 0.5.5 — 2017-11-10
- 0.5.4 — 2017-11-10
- 0.5.3 — 2017-11-09
- … 18 more at https://npm.io/package/mochadoc/versions

## README

Mochadoc
========

The dead simple way to create docs from Mocha BDD & TDD, Jasmine and Jest tests.

Find me online:
- [@cm_stead](https://twitter.com/cm_stead)
- [ChrisStead.com](http://www.chrisstead.com)

## Setup ##

First install Mochadoc globally from NPM:

`npm install -g mochadoc`

After installation, open a console/terminal in your project root directory and set up a new mochadoc configuration with the following command:

`mochadoc --init`

If you would prefer to have your configuration in your package file, you can create it by hand.  The format is detailed below.

**Add configuration to your package.json like this:**

```
{
    "scripts": {
        ...
    },
    "mochadoc": {
        "projectName": "My Amazing Project",
        "files": "./test/**/*.js",
        "dest": "./docs/api"
    }
}
```

**Create a standalone configuration by creating a .mochadocrc file like this:**

```
{
    "projectName": "My Amazing Project",
    "files": "./test/**/*.js",
    "dest": "./docs/api"
}
```

The config file can be stored elsewhere and referenced with the `--config` flag.

## Running Mochadoc ##

Mochadoc has a rich CLI option set.  By default, verbose mode is enabled, and file writing is the core behavior.  Mochadoc will automatically search for a config file in the directory it is called from.  Basic execution is as follows:

`mochadoc`

For a list of the entire set of options, run mochadoc with the help option:

`mochadoc --help`

The option which is most likely to be useful is the alternate configuration option:

`mochadoc --config path/to/config/file`

## Mochadoc Help Output ##

__Mochadoc - the fast, easy test to document utility__

  Generates documents from Mocha BDD, Jasmine and Jest test files.

__Synopsis__

Examples of use:

```bash
$ mochadoc --init
$ mochadoc --help
$ mochadoc [--silent] [--json] [--config path/to/file]
```

__Options__

| Switch | Input Type | Description |
| --- | --- | --- |
| -c, --config | filePath | Alternate location for config file|
| --dryrun | | Does everything except write to file system |
| -h, --help | | Outputs command docs |
| --init | | Generates a new mochadocrc file |
| --json | | Outputs title raw JSON to stdout |
| -s, --silent | | Turns off all logging |

## Changelog ##

**v0.9.0**

- Added collapsible describe content

**v0.8.0**

- Refactored code for maintenance ease
- Updated test capture code to capture Mocha TDD test suites

**v0.7.0**

- Added code sample collapsing in generated docs for easier scanning

**v0.6.0**

- Added init behavior
- Improved tests around internal code
- Updated error messaging when mochadoc config is missing

**v0.5.0**

- Added CLI options

**v0.4.1**

- Alphabetized results on index page
- Fixed underline bug in header

**v0.3.0**

- Added styles and formatting
- Updated config handler to use projectName property

**v0.2.1**

- Updated to handle cases where describe blocks are not used
- Added support for Jest "test" syntax instead of "it"
- Improved description argument handling for non-string values

**v0.1.1**

- Initial release of mochadoc
- Reads tests using glob syntax
- Writes raw (unstyled) HTML docs to specified destination

---
_Source: https://npm.io/package/mochadoc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
