# runas-recipe-unit-testing

> Unit testing for the recipe context. Include coverage validation

Latest version **0.3.0** (published 2017-10-05) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install runas-recipe-unit-testing
pnpm add runas-recipe-unit-testing
yarn add runas-recipe-unit-testing
bun add runas-recipe-unit-testing
```

## 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.3.0 |
| Published | 2017-10-05 |
| First published | 2017-10-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 7 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | alberto.eyo.contractor, sbonacho, apecr |
| Keywords | runas-recipe, unit-testing, recipe, npm-library |

## Links

- npm: https://www.npmjs.com/package/runas-recipe-unit-testing
- npm.io page: https://npm.io/package/runas-recipe-unit-testing

## Dependencies (7)

- [nyc](https://npm.io/package/nyc.md) ^11.2.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [runas-core](https://npm.io/package/runas-core.md) ^0.1.0
- [spawn-wrap](https://npm.io/package/spawn-wrap.md) ^1.3.8
- [istanbul-api](https://npm.io/package/istanbul-api.md) ^1.1.14
- [runas-callback-to-promise](https://npm.io/package/runas-callback-to-promise.md) ^0.1.1
- [runas-plugin-test-runner-nyc](https://npm.io/package/runas-plugin-test-runner-nyc.md) ^0.2.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2017-10-05
- 0.3.0-beta.1 (beta) — 2017-10-05
- 0.3.0-beta.0 — 2017-10-05
- 0.2.0 — 2017-10-02
- 0.2.0-beta.0 — 2017-10-02

## README

# runas Recipe runas-recipe-unit-testing

Unit testing with coverage for recipes and npm-libraries. 
Using [mocha][1] (default) and [nyc][2] for the matter. 

1. [Description](#description)
1. [Configuration](#configuration)
1. [More information](#more)

## <a name="description"></a>Description

Step for **recipe** and **npm-library** contexts. It will run the
tests configured in the repo and will calculate the coverage of
such test suites. It will check the thresholds for this repo in
particular.

We will be able to configure our recipe parameters as usual, in
our *piscosour.json* file. But we also can configure it in the
*package.json* or in a *.nycrc* file. All the documentation in
[this link][3]

## <a name="configuration"></a>Configuration

Example:

```json
{
  "test-runner-nyc": {
    "ignoreErrors": true,
    "config": {
      "_": [
        "npm",
        "test"
      ],
      "all": true,
      "reportDir": "test-reports",
      "reporter": [
        "text-summary",
        "lcov",
        "html"
      ],
      "exclude": [
        "node_modules",
        "*-test.js",
        "test-reports/**",
        "test/**"
      ],
      "checkCoverage": true,
      "statements": 70,
      "branches": 70,
      "functions": 70,
      "lines": 70
    }
  }
}
```

Where:

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| _ | Array | ["npm", "test"] | Execution for the unit tests in the recipe |
| all | Boolean | true | Include all the files in the coverage report |
| reportDir | String | "test-reports" | Directory where the reports are stored |
| reporter | Array | ["text-summary", "lcov", "html"] | Reports generated |
| exclude | Array | ["node_modules", "*-test.js", "test-reports/**", "test/**"] | Files excluded |
| checkCoverage | Boolean | true | Check for the coverage thresholds |
| statements | Integer | 70 | Threshold for staments percent coverage |
| branches | Integer | 70 | Threshold for branches percent coverage |
| functions | Integer | 70 | Threshold for functions percent coverage |
| lines | Integer | 70 | Threshold for lines percent coverage |

## <a name="more"></a>More information:

- Contexts: "recipe", "npm-library"
- Plugins: "test-runner-istanbul"

[1]: https://mochajs.org/
[2]: https://istanbul.js.org/docs/tutorials/mocha/
[3]: https://github.com/istanbuljs/nyc#configuring-nyc

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