1.0.1 • Published 8 years ago

node-mocha-reporter v1.0.1

Weekly downloads
4
License
CC-BY-SA-4.0
Repository
github
Last release
8 years ago

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
    }]
}