Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/generate/generate-mocha

Generate mocha unit tests.
https://github.com/generate/generate-mocha

app cli create dev generate generator init initialize new project prompt scaffold scaffolder scaffolding template yeoman yo

Last synced: about 2 hours ago
JSON representation

Generate mocha unit tests.

Awesome Lists containing this project

README

        




Generate mocha test files.

# generate-mocha

[![NPM version](https://img.shields.io/npm/v/generate-mocha.svg?style=flat)](https://www.npmjs.com/package/generate-mocha) [![NPM downloads](https://img.shields.io/npm/dm/generate-mocha.svg?style=flat)](https://npmjs.org/package/generate-mocha) [![Build Status](https://img.shields.io/travis/generate/generate-mocha.svg?style=flat)](https://travis-ci.org/generate/generate-mocha)

![generate-mocha demo](https://raw.githubusercontent.com/generate/generate-mocha/master/docs/demo.gif)

## Table of Contents

- [Quickstart](#quickstart)
- [Files trees](#files-trees)
- [What is "Generate"?](#what-is-generate)
- [Getting started](#getting-started)
* [Install](#install)
* [Usage](#usage)
* [Help](#help)
- [About](#about)
* [Related projects](#related-projects)
* [Community](#community)
* [Contributing](#contributing)
* [Running tests](#running-tests)
* [Release history](#release-history)
* [Author](#author)
* [License](#license)

_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_

## Quickstart

**Install**

Install [generate](https://github.com/generate/generate) and `generate-mocha`:

```sh
$ npm install --global generate generate-mocha
```

**Generate a test.js file**

Initiate a prompt to generate a `test.js` file in the current working directory:

```sh
$ gen mocha
$ gen mocha --dest ./foo
```

## Files trees

The following files trees are automatically generated by a task in [verbfile.js](verbfile.js).

* [generated files](#generated-files): trees representing the actual generated "dest" files for each task
* [source files](#source-files): trees representing the source files and templates used by each task

_(See Generate's [customization docs ](https://github.com/generate/generate/blob/master/docs/customization.md) to learn how to override individual templates.)_

### Generated files

Files generated by each task (e.g. `dest` files). See the Generate [customization docs ](https://github.com/generate/generate/blob/master/docs/customization.md) to learn how to override individual templates.

Note that diffs are base on comparisons against the files generated by the `default` task. Additionally, some tasks generate the same files, but with different contents (for example, the contents of `index.js` differs based on the task).

#### default

Files generated by the [default task](#default):

```diff
.
└── test.js
```

#### base

Files generated by the [base task](#base):

```diff
.
└── test.js
```

#### generator

Files generated by the [generator task](#generator):

```diff
.
+└─┬ test
├── test.js
+ └── plugin.js
```

#### updater

Files generated by the [updater task](#updater):

```diff
.
+└─┬ test
├── test.js
+ └── plugin.js
```

### Source files

The following trees represent the source files or templates that are used by each task. You'll see that most of the tasks use at least one "micro-generator" to generate a specific file.

#### default

Source files and/or libraries used by the [default task](#default):

```diff
.
└─┬ templates
├── base.js
└── test.js
```

#### base

Source files and/or libraries used by the [base task](#base):

```diff
.
└─┬ templates
└── base.js
```

#### generator

Source files and/or libraries used by the [generator task](#generator):

```diff
.
└─┬ scaffolds
└─┬ generator
└─┬ templates
├── plugin.js
└── test.js
```

#### updater

Source files and/or libraries used by the [updater task](#updater):

```diff
.
└─┬ scaffolds
└─┬ updater
└─┬ templates
├── plugin.js
└── test.js
```

## What is "Generate"?

Generate is a command line tool and developer framework for scaffolding out new GitHub projects using [generators](https://github.com/generate/generate/blob/master/docs/generators.md) and [tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).

Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for [gulp](http://gulpjs.com), [base](https://github.com/node-base/base) and [assemble](https://github.com/assemble/assemble) plugins, and much more.

**For more information**:

* Visit the [generate project](https://github.com/generate/generate/)
* Visit the [generate documentation](https://github.com/generate/generate/blob/master/docs/)
* Find [generators on npm](https://www.npmjs.com/browse/keyword/generate-generator) (help us [author generators](https://github.com/generate/generate/blob/master/docs/micro-generators.md))

## Getting started

### Install

**Installing the CLI**

To run the `mocha` generator from the command line, you'll need to install [Generate](https://github.com/generate/generate) globally first. You can do that now with the following command:

```sh
$ npm install --global generate
```

This adds the `gen` command to your system path, allowing it to be run from any directory.

**Install generate-mocha**

Install this module with the following command:

```sh
$ npm install --global generate-mocha
```

### Usage

Run this generator's `default` [task](https://github.com/generate/generate/blob/master/docs/tasks.md#default) with the following command:

```sh
$ gen mocha
```

**What you should see in the terminal**

If completed successfully, you should see both `starting` and `finished` events in the terminal, like the following:

```sh
[00:44:21] starting ...
...
[00:44:22] finished ✔
```

If you do not see one or both of those events, please [let us know about it](../../issues).

### Help

To see a general help menu and available commands for Generate's CLI, run:

```sh
$ gen help
```

## Tasks

All available tasks.

### [default](generator.js#L55)

Alias for the [test](#test) task. Allows the generator to be run with the following command:

**Example**

```sh
$ gen mocha
```

### [base](generator.js#L67)

Generate a `test.js` file with unit tests for a [base](https://github.com/node-base/base) project.

**Example**

```sh
$ gen mocha:base
```

### [gulp](generator.js#L79)

Generate a `test.js` file with unit tests for a [gulp](http://gulpjs.com) plugin project.

**Example**

```sh
$ gen mocha:gulp
```

### [generator](generator.js#L96)

Generate unit tests for a [generate](https://github.com/generate/generate) generator. Creates:

* `test.js`
* `plugin.js`

**Example**

```sh
$ gen mocha:gen
# aliased as
$ gen mocha:generator
```

### [updater](generator.js#L112)

Generate unit tests for an [update](https://github.com/update/update) "updater". Creates:

* `test.js`
* `plugin.js`

**Example**

```sh
$ gen mocha:updater
```

Visit Generate's [documentation for tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).

## About

### Related projects

* [generate-git](https://www.npmjs.com/package/generate-git): Generator for initializing a git repository and adding first commit. | [homepage](https://github.com/generate/generate-git "Generator for initializing a git repository and adding first commit.")
* [generate-license](https://www.npmjs.com/package/generate-license): Generate a license file for a GitHub project. | [homepage](https://github.com/generate/generate-license "Generate a license file for a GitHub project.")
* [generate-node](https://www.npmjs.com/package/generate-node): Generate a node.js project, with everything you need to begin writing code and easily publish… [more](https://github.com/generate/generate-node) | [homepage](https://github.com/generate/generate-node "Generate a node.js project, with everything you need to begin writing code and easily publish the project to npm.")
* [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate "Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.")

### Community

Are you using [Generate](https://github.com/generate/generate) in your project? Have you published a [generator](https://github.com/generate/generate/blob/master/docs/generators.md) and want to share your project with the world?

Here are some suggestions!

* If you get like Generate and want to tweet about it, please feel free to mention `@generatejs` or use the `#generatejs` hashtag
* Show your love by starring [Generate](https://github.com/generate/generate) and `generate-mocha`
* Get implementation help on [StackOverflow](http://stackoverflow.com/questions/tagged/generate) (please use the `generatejs` tag in questions)
* **Gitter** Discuss Generate with us on [Gitter](https://gitter.im/generate/generate)
* If you publish an generator, thank you! To make your project as discoverable as possible, please add the keyword `generategenerator` to package.json.

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

### License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/generate/generate-mocha/blob/master/LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on August 17, 2016._