tap-summary
A reporter for TAP.
Example
Usage
package.json
CLI Options
--no-ansi Disable ANSI formatting
--no-progress Disable progress output during tests
API
var summarize = var fs = fs
Also, the default formatter could be replaced with custom ones.
var reporter = var fs = fs
The reporter
is a Duplex
,
which consumes the TAP input and output nothing by default.
However, it emits the following events during the process,
so that customize
could listen to them and add something into the output.
- reporter.on('test.start', test => {}). Fired when a new test detected.
- reporter.on('test.end', test => {}). Fired when the end of a test reached.
- reporter.on('test.assert', (assertion, test) => {}). Fired when a new assertion found.
- reporter.on('summary', (stats, fails, comments) => {}). Fired when all TAP input has been processed.
Details about the test
and assertion
object could be found here.
The stats
object:
var stats = // the total time (ms) it takes duration: duration // the total number of assertions planned planned: resplans // the actual total number of assertions found assertions: resassertslength // the number of successful assertions pass: respasslength // the number of failed assertions fail: resfaillength // the number of comments found comments: rescommentslength
fails
will be null
unless stats.fail > 0
:
testName: failedAssertion
comments
will be null
unless stats.comments > 0
:
testName: comment