node-mocha-reporter

1.0.1 • Public • Published

Node Mocha Reporter

A mocha reporter not tied to STDOUT that provides tests results in a json object.

Usage

var Mocha = require('mocha');
var NodeMochaReporter = require('node-mocha-reporter');
var mocha = new Mocha({ reporter: NodeMochaReporter });

// Any additional setup for this mocha run instance, like adding tests
mocha.addFile('path/to/my/test.js');

// Run mocha
mocha.run(function(report) {
    // Use report as needed
});

Report format

{
    passed: [{
        description: String,
        suite: [String],
        success: Boolean,
        skipped: Boolean,
        duration: Number,
        testBody: String,
        error: String
    }],
    failed: [{
        description: String,
        suite: [String],
        success: Boolean,
        skipped: Boolean,
        duration: Number,
        testBody: String,
        error: String
    }],
    skipped: [{
        description: String,
        suite: [String],
        success: Boolean,
        skipped: Boolean,
        duration: Number,
        testBody: String,
        error: String
    }]
}

Readme

Keywords

Package Sidebar

Install

npm i node-mocha-reporter

Weekly Downloads

7

Version

1.0.1

License

CC-BY-SA-4.0

Last publish

Collaborators

  • spidy88