npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mochadoc

v0.9.4

Published

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

Downloads

237

Readme

Mochadoc

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

Find me online:

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:

$ 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