https://github.com/sumanjs/suman-reporters
All official Suman reporters go here.
https://github.com/sumanjs/suman-reporters
nodejs reporter reporters suman sumanjs test-runner test-runners
Last synced: 10 months ago
JSON representation
All official Suman reporters go here.
- Host: GitHub
- URL: https://github.com/sumanjs/suman-reporters
- Owner: sumanjs
- License: mit
- Created: 2017-07-05T05:42:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-30T02:03:27.000Z (about 7 years ago)
- Last Synced: 2024-04-24T14:37:36.614Z (over 1 year ago)
- Topics: nodejs, reporter, reporters, suman, sumanjs, test-runner, test-runners
- Language: JavaScript
- Homepage:
- Size: 224 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Contributing: CONTRIBUTING.md
- License: license.md
Awesome Lists containing this project
README
# Official Suman reporters
This repo contains reporters for both Node.js and the browser. Suman supports asynchronous reporters, so that reporters
can persist data using async I/O, etc, if they wish.
If you are using a language other than JS with the Suman runner:
what you do is write TAP or TAP-JSON to stdout in the language of your choice,
and the Suman runner will capture the stdout from your child process, and then use one of these reporters
to report the output in a more human friendly format in the parent process (the Suman runner is the parent process).
## Installing
```bash
$ npm install suman-reporters
```
## Loading reporters
Suman reporters in this package can be imported like so:
```typescript
// typescript
import r = require('suman-reporters/modules/tap-reporter');
```
```js
// js
const r = require('suman-reporters/modules/tap-reporter');
```
To use a reporter with the suman command line, the API is like so:
```bash
$ suman --reporter="tap-reporter"
```
You can load multiple reporters like so:
```bash
$ suman --reporter="tap-reporter" --reporter="std-reporter"
```
### The loading logic is as follows:
1. First suman will attempt to `require('tap-reporter')`
2. If the above fails, then it will attempt to `require('suman-reporters/modules/tap-reporter')`
So for "max efficiency", you could just use this:
```bash
$ suman --reporter="suman-reporters/modules/tap-reporter"
```
## Anatomy of a Suman-compliant reporter:
Export a function, either with `module.exports` or `exports.default`.
This function takes 4 arguments:
```js
exports.default = function(s, o, expct, c){
// s is an event emitter instance
// o is a copy of the suman command line options as a plain object
// expct is a plain object representing the expected pass/fail/skipped/stubbed counts
// c is a socket.io client
}
```
Take a look at the modules directory for up-to-date samples; TypeScript will aid in getting the types right.