Sun calculation js library which is fully based on formula from http://aa.quae.nl/en/reken/zonpositie.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

69 lines
1.3 KiB

'use strict';
/**
* @module JSONStream
*/
/**
* Module dependencies.
*/
var Base = require('./base');
/**
* Expose `List`.
*/
exports = module.exports = List;
/**
* Initialize a new `JSONStream` test reporter.
*
* @public
* @name JSONStream
* @class JSONStream
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
* @api public
* @param {Runner} runner
*/
function List (runner) {
Base.call(this, runner);
var self = this;
var total = runner.total;
runner.on('start', function () {
console.log(JSON.stringify(['start', { total: total }]));
});
runner.on('pass', function (test) {
console.log(JSON.stringify(['pass', clean(test)]));
});
runner.on('fail', function (test, err) {
test = clean(test);
test.err = err.message;
test.stack = err.stack || null;
console.log(JSON.stringify(['fail', test]));
});
runner.once('end', function () {
process.stdout.write(JSON.stringify(['end', self.stats]));
});
}
/**
* Return a plain-object representation of `test`
* free of cyclic properties etc.
*
* @api private
* @param {Object} test
* @return {Object}
*/
function clean (test) {
return {
title: test.title,
fullTitle: test.fullTitle(),
duration: test.duration,
currentRetry: test.currentRetry()
};
}