@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.
Last updated a year ago by guseyn .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cuties/wall 
SYNC missed versions from official npm registry.

wall

Wall is a tool that includes static analysis and test coverage. It was mainly made for Page and based on the Async Tree Pattern.

NPM Version Build Status codecov

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.

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

Async call: executedLint.

ExecutedTestCoverage

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

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

File test-executor contains script that runs all your tests. You can use this library for doing such things.

Async call: executedTestCoverage.

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.

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

Async call: executedTestCoverageCheck.

ExecutedTestCoverageReport

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

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

Async call: executedTestCoverageReport. About format(default value is text) of report you can read here.

Complete example

For making your project more qualitative use following composition:

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

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

executor('./test');

test-executor library

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) and ParsedJson(cutie-json):

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%

Current Tags

  • 1.1.2                                ...           latest (a year ago)

21 Versions

  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.19                                ...           a year ago
  • 1.0.18                                ...           a year ago
  • 1.0.17                                ...           a year ago
  • 1.0.16                                ...           a year ago
  • 1.0.15                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago

Copyright 2014 - 2017 © taobao.org |