A simple TAP report producer based on event system. A plugin for
dush
event emitter or anything based on it
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.
(TOC generated by verb using markdown-toc)
Install with npm
$ npm install dush-tap-report --save
or install using yarn
$ yarn add dush-tap-report
For more use-cases see the tests
const dushTapReport = require('dush-tap-report')
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 withapp.options
, passed to stacktrace-metadata and find-callsiteoptions.writeLine
{Function}: a logger function called on each line, defaultconsole.log
options.cleanStack
{Boolean}: iffalse
won't clean stack trace from node internals, clean-stacktraceoptions.shortStack
{Boolean}: iffalse
full stack traces, otherwise they are just fouroptions.showStack
{Boolean}: iffalse
the error.stack will be empty stringoptions.relativePaths
{Boolean}: iffalse
paths in stack traces will be absolute, clean-stacktrace-relative-pathsoptions.mapper
{Function}: called on each line of the stack with(line, index)
signatureoptions.cwd
{String}: current working directory, defaultprocess.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
- always-done: Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement… more | homepage
- clean-stacktrace: Clean up error stack traces from node internals | homepage
- minibase-create-plugin: Utility for minibase and base that helps you create plugins | homepage
- minibase-is-registered: Plugin for minibase and base, that adds
isRegistered
method to your application to detect if plugin is already registered and… more | homepage - minibase: Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing… more | homepage
- stacktrace-metadata: Modify given
err
object to be more useful - addsat
,line
,column
,place
andfilename
properties and also cleans… more | homepage - try-catch-core: Low-level package to handle completion and errors of sync or asynchronous functions, using once and dezalgo libs. Useful for and… more | homepage
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
- Please DO NOT edit README.md, CHANGELOG.md and .verb.md files. See "Building docs" section.
- Ensure anything is okey by installing the dependencies and run the tests. See "Running tests" section.
- Always use
npm run commit
to commit changes instead ofgit commit
, because it is interactive and user-friendly. It uses commitizen behind the scenes, which follows Conventional Changelog idealogy. - 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! :)
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.
Clone repository and run the following in that cloned directory
$ npm install && npm test
Charlike Mike Reagent
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.