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