dush-tap-report

1.0.0 • Public • Published

dush-tap-report NPM version mit license NPM monthly downloads npm total downloads

A simple TAP report producer based on event system. A plugin for dush event emitter or anything based on it

code climate code style linux build windows build code coverage dependency status paypal donate

You might also be interested in dush - an event emitter system, extensible through plugins. Or minibase, a tiny framework based on dush for building robust and complex applications.

Table of Contents

(TOC generated by verb using markdown-toc)

Install

Install with npm

$ npm install dush-tap-report --save

or install using yarn

$ yarn add dush-tap-report

Usage

For more use-cases see the tests

const dushTapReport = require('dush-tap-report')

API

tapReport

A simple TAP report producing plugin for dush or anything based on it. It returns a function that can be passed to dush's .use method. This plugin will also work for minibase and base mini frameworks for building robust apps.

Params

  • options {Object}: optional options, merged with app.options, passed to stacktrace-metadata and find-callsite
  • options.writeLine {Function}: a logger function called on each line, default console.log
  • options.cleanStack {Boolean}: if false won't clean stack trace from node internals, clean-stacktrace
  • options.shortStack {Boolean}: if false full stack traces, otherwise they are just four
  • options.showStack {Boolean}: if false the error.stack will be empty string
  • options.relativePaths {Boolean}: if false paths in stack traces will be absolute, clean-stacktrace-relative-paths
  • options.mapper {Function}: called on each line of the stack with (line, index) signature
  • options.cwd {String}: current working directory, default process.cwd()
  • returns {Function}: a plugin function that should be passed to .use method of minibase, base or dush

Example

const reporter = require('dush-tap-report')
const dush = require('dush')
 
const app = dush()
 
// provide a fake stats object
// so `finish` to work correctly
app.use(reporter({
  stats: {
    count: 3,
    pass: 2,
    fail: 1
  }
}))
 
const item = {
  index: 1,
  title: 'some passing test'
}
const failing = {
  index: 2,
  title: 'failing test, sorry',
  reason: new Error('some sad error here')
}
const item2 = {
  index: 3,
  title: 'awesome test is okey'
}
 
app.emit('start', app)
// => 'TAP version 13'
 
app.emit('pass', app, item)
// =>
// # :) some passing test
// ok 1 - some passing test
 
app.emit('fail', app, failing)
// =>
// # :( failing test, sorry
// not ok 2 - failing test, sorry
 
app.emit('pass', app, item2)
// =>
// # :) awesome test is okey
// ok 3 - awesome test is okey
 
app.emit('finish', app)
// =>
// 1..3
// # tests 3
// # pass  2
// # fail  1

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guidelines for advice on opening issues, pull requests, and coding standards.
If you need some help and can spent some cash, feel free to contact me at CodeMentor.io too.

In short: If you want to contribute to that project, please follow these things

  1. Please DO NOT edit README.md, CHANGELOG.md and .verb.md files. See "Building docs" section.
  2. Ensure anything is okey by installing the dependencies and run the tests. See "Running tests" section.
  3. Always use npm run commit to commit changes instead of git commit, because it is interactive and user-friendly. It uses commitizen behind the scenes, which follows Conventional Changelog idealogy.
  4. Do NOT bump the version in package.json. For that we use npm run release, which is standard-version and follows Conventional Changelog idealogy.

Thanks a lot! :)

Building docs

Documentation and that readme is generated using verb-generate-readme, which is a verb generator, so you need to install both of them and then run verb command like that

$ npm install verbose/verb#dev verb-generate-readme --global && verb

Please don't edit the README directly. Any changes to the readme must be made in .verb.md.

Running tests

Clone repository and run the following in that cloned directory

$ npm install && npm test

Author

Charlike Mike Reagent

License

Copyright © 2017, Charlike Mike Reagent. Released under the MIT License.


This file was generated by verb-generate-readme, v0.4.3, on March 19, 2017.
Project scaffolded using charlike cli.

Package Sidebar

Install

npm i dush-tap-report

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • vanchoy
  • tunnckocore