# @cuties/wall

> Quality checker for projects for browser js and Node.js, can be integrated in build process of Page, also can be as stand alone application.

Latest version **1.1.2** (published 2019-05-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cuties/wall
pnpm add @cuties/wall
yarn add @cuties/wall
bun add @cuties/wall
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2019-05-10 |
| First published | 2018-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | guseyn |
| Maintainers | guseyn |
| Keywords | static, analysis, test, coverage, mutation, test, coverage, integration, tests, unit, tests, page, cutie |

## Links

- npm: https://www.npmjs.com/package/@cuties/wall
- Repository: https://github.com/Guseyn/wall
- Homepage: https://github.com/Guseyn/wall#readme
- Issues: https://github.com/Guseyn/wall/issues
- npm.io page: https://npm.io/package/@cuties/wall

## Dependencies (4)

- [nyc](https://npm.io/package/nyc.md) ^14.1.1
- [eslint](https://npm.io/package/eslint.md) ^5.13.0
- [@cuties/cutie](https://npm.io/package/@cuties/cutie.md) ^1.7.5
- [test-executor](https://npm.io/package/test-executor.md) ^1.2.4

## 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

- 1.1.2 (latest) — 2019-05-10
- 1.1.1 — 2019-05-10
- 1.1.0 — 2019-02-21
- 1.0.19 — 2019-02-17
- 1.0.18 — 2019-02-17
- 1.0.17 — 2019-02-16
- 1.0.16 — 2019-02-15
- 1.0.15 — 2019-02-15
- 1.0.14 — 2019-02-15
- 1.0.13 — 2019-02-15
- 1.0.12 — 2019-02-15
- 1.0.11 — 2019-02-15
- 1.0.8 — 2019-02-11
- 1.0.7 — 2019-02-11
- 1.0.6 — 2019-01-16
- … 6 more at https://npm.io/package/@cuties/wall/versions

## README

# wall

**Wall** is a tool that includes [static analysis](https://github.com/eslint/eslint) and [test coverage](https://github.com/istanbuljs/nyc). It was mainly made for [Page](https://github.com/Guseyn/page) and based on the [Async Tree Pattern](https://github.com/Guseyn/async-tree-patern/blob/master/Async_Tree_Patern.pdf).

[![NPM Version](https://img.shields.io/npm/v/@cuties/wall.svg)](https://npmjs.org/package/@cuties/wall)
[![Build Status](https://travis-ci.org/Guseyn/wall.svg?branch=master)](https://travis-ci.org/Guseyn/wall)
[![codecov](https://codecov.io/gh/Guseyn/wall/branch/master/graph/badge.svg)](https://codecov.io/gh/Guseyn/wall)

## Install

`npm install @cuties/wall`

### Init eslint

`node_modules/.bin/eslint --init`

## Test

`npm test`

## Build

`npm run build`

## Async objects

### ExecutedLint

This async object represents the `process` where static analysis is executed.

```js
new ExecutedLint(process, './src').call()

```

**Async call:** [executedLint](https://github.com/Guseyn/wall/blob/master/src/custom-calls/executedLint.js).

### ExecutedTestCoverage

This async object represents the `process` where test coverage is executed.

```js
new ExecutedTestCoverage(
  process, './test-executor.js'
).call()

```

File `test-executor` contains script that runs all your tests. You can use [this library](https://github.com/Guseyn/node-test-executor) for doing such things.

**Async call:** [executedTestCoverage](https://github.com/Guseyn/wall/blob/master/src/custom-calls/executedTestCoverage.js).

### ExecutedTestCoverageCheck

This async object represents the `process` where test coverage check is executed(after running tests via `ExecutedTestCoverage`). If coverage falls below a threshold (that can be configured via `ConfiguredTestCoverage`) the `process` fails. You can configure required test coverage percentages of *lines*, *functions* and *branches* via options in params.

```js
new ExecutedTestCoverageCheck(
  new ExecutedTestCoverage(process, '/test-executor.js'),
  { lines: 100, functions: 100, branches: 100, 'statements': 100 }
).call()

```

**Async call:** [executedTestCoverageCheck](https://github.com/Guseyn/wall/blob/master/src/custom-calls/executedTestCoverageCheck.js).

### ExecutedTestCoverageReport

This async object represents the `process` where test coverage is reported (after running tests via `ExecutedTestCoverage`).

```js
new ExecutedTestCoverageReport(
  new ExecutedTestCoverage(process, '/test-executor.js'), 'json-summary'
).call()

```

**Async call:** [executedTestCoverageReport](https://github.com/Guseyn/wall/blob/master/src/custom-calls/executedTestCoverageReport.js). About format(default value is `text`) of report you can read [here](https://istanbul.js.org/docs/advanced/alternative-reporters/).

## Complete example

For making your project more qualitative use following composition:

```js
const {
  ExecutedLint,
  ExecutedTestCoverage,
  ExecutedTestCoverageCheck,
  ExecutedTestCoverageReport
} = require('@cuties/wall')

new ExecutedLint(process, './src').after(
  new ExecutedTestCoverageCheck(
    new ExecutedTestCoverageReport(
      new ExecutedTestCoverage(
        process, './test-executor.js'
      ), 'json-summary'
    ), { lines: 100, functions: 100, branches: 100, statements: 100 }
  )
).call()

```

### `test-executor.js`

```js
const executor = require('test-executor');

executor('./test');

```

### [test-executor library](https://github.com/Guseyn/node-test-executor)

## Log total coverage (LoggedTotalCoverageByJsonSummary)

If you use `json-summary` in `ExecutedTestCoverageReport`, then this async object generates report into `coverage/coverage-summary.json` file. And you can log to console total coverage numbers via `LoggedTotalCoverageByJsonSummary`, `ReadDataByPath`([cutie-fs](https://github.com/Guseyn/cutie-fs)) and `ParsedJson`([cutie-json](https://github.com/Guseyn/cutie-json)):

```js
const { ReadDataByPath } = require('@cuties/fs')
const { ParsedJSON } = require('@cuties/json')
const { ExecutedTestCoverage, ExecutedTestCoverageReport, LoggedTotalCoverageByJsonSummary } = require('./../index')

new ExecutedTestCoverageReport(
  new ExecutedTestCoverage(process, './test-executor.js'),
  'json-summary'
).after(
  new LoggedTotalCoverageByJsonSummary(
    new ParsedJSON(
      new ReadDataByPath('coverage/coverage-summary.json', { encoding: 'utf8' })
    ), (linesPct, statementsPct, functionsPct, branchesPct) => {
      return (linesPct + statementsPct + functionsPct + branchesPct) / 4
    }
  )
).call()

```

First argument of `LoggedTotalCoverageByJsonSummary` is json that contains coverage numbers(lines, statements, functions, branches percentages), second one is a function that calculates total number (in that case we just take average value of coverage numbers).

Output would look like:

`Total coverage: 100%`

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