mocha-notifier-reporter
Show notification with other Mocha reporters
Last updated 4 years ago by hakovala .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mocha-notifier-reporter 
SYNC missed versions from official npm registry.

mocha-notifier-reporter

mocha-notifier-reporter is a reporter that shows notification using node-notifier with customizable values. Default notification is similar to Mocha growl option. It can also add notifications to other Mocha reporters.

Installation

npm install mocha-notifier-reporter

Usage

It's easy to show notifications from Gulp tests.

var gulp = require('gulp');
var mocha = require('mocha');

// stand-alone usage
gulp.task('test-notify-only', function() {
	gulp.src('test/*.js')
		.pipe(mocha({
			reporter: 'mocha-notifier-reporter'
		}));
});

Use decorate method to use other reporter at the same time. decorate takes same argument as Mocha for reporter property.

See here for other possible reporters.

var gulp = require('gulp');
var mocha = require('mocha');
var notifierReporter = require('mocha-notifier-reporter');

// stand-alone usage
gulp.task('test-notify-only', function() {
	gulp.src('test/*.js')
		.pipe(mocha({
			reporter: notifierReporter.decorate('spec')
		}));
});	

Options

mocha-notifier-reporter has few options to change notifications behavior and looks.

var notifierReporter = require('mocha-notifier-reporter');

options property is passed to node-notifier. Except icon, title and message options, which are overridden with values below.

notifierReporter.options = {}; // options for node-notifier

Change notification icons with icon_pass and icon_fail properties.

notifierReporter.icon_pass = 'path to pass image';
notifierReporter.icon_fail = 'path to fail image';

Title and message strings are parsed using node-printf with stats object.

Possible variables are: suites, tests, passes, pending, failures, total, start, end, duration

notifierReporter.title_pass = 'pass title'; // defaults to 'Passed'
notifierReporter.title_fail = 'fail title'; // defaults to 'Failed'
notifierReporter.message_pass = 'pass message'; // defaults to '%(passes)d tests passed in %(duration)dms'
notifierReporter.message_fail = 'fail message'; // defaults to '%(failures)d of %(total)d tests failed'

Current Tags

  • 0.1.2                                ...           latest (4 years ago)

3 Versions

  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |