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.
76 lines
1.3 KiB
76 lines
1.3 KiB
'use strict';
|
|
/**
|
|
* @module TAP
|
|
*/
|
|
/**
|
|
* Module dependencies.
|
|
*/
|
|
|
|
var Base = require('./base');
|
|
|
|
/**
|
|
* Expose `TAP`.
|
|
*/
|
|
|
|
exports = module.exports = TAP;
|
|
|
|
/**
|
|
* Initialize a new `TAP` reporter.
|
|
*
|
|
* @public
|
|
* @class
|
|
* @memberof Mocha.reporters
|
|
* @extends Mocha.reporters.Base
|
|
* @api public
|
|
* @param {Runner} runner
|
|
*/
|
|
function TAP (runner) {
|
|
Base.call(this, runner);
|
|
|
|
var n = 1;
|
|
var passes = 0;
|
|
var failures = 0;
|
|
|
|
runner.on('start', function () {
|
|
var total = runner.grepTotal(runner.suite);
|
|
console.log('%d..%d', 1, total);
|
|
});
|
|
|
|
runner.on('test end', function () {
|
|
++n;
|
|
});
|
|
|
|
runner.on('pending', function (test) {
|
|
console.log('ok %d %s # SKIP -', n, title(test));
|
|
});
|
|
|
|
runner.on('pass', function (test) {
|
|
passes++;
|
|
console.log('ok %d %s', n, title(test));
|
|
});
|
|
|
|
runner.on('fail', function (test, err) {
|
|
failures++;
|
|
console.log('not ok %d %s', n, title(test));
|
|
if (err.stack) {
|
|
console.log(err.stack.replace(/^/gm, ' '));
|
|
}
|
|
});
|
|
|
|
runner.once('end', function () {
|
|
console.log('# tests ' + (passes + failures));
|
|
console.log('# pass ' + passes);
|
|
console.log('# fail ' + failures);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Return a TAP-safe title of `test`
|
|
*
|
|
* @api private
|
|
* @param {Object} test
|
|
* @return {String}
|
|
*/
|
|
function title (test) {
|
|
return test.fullTitle().replace(/#/g, '');
|
|
}
|
|
|