2014-03-04 04:33:44 +00:00
|
|
|
'use strict';
|
|
|
|
/*
|
2014-06-01 05:57:36 +00:00
|
|
|
* Test that bunyan process will terminate.
|
|
|
|
*
|
|
|
|
* Note: Currently (bunyan 0.23.1) this fails on node 0.8, because there is
|
|
|
|
* no `unref` in node 0.8 and bunyan doesn't yet have `Logger.prototype.close()`
|
|
|
|
* support.
|
2014-03-04 04:33:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
var exec = require('child_process').exec;
|
|
|
|
|
|
|
|
// node-tap API
|
|
|
|
if (require.cache[__dirname + '/tap4nodeunit.js'])
|
2014-06-01 05:25:06 +00:00
|
|
|
delete require.cache[__dirname + '/tap4nodeunit.js'];
|
2014-03-04 04:33:44 +00:00
|
|
|
var tap4nodeunit = require('./tap4nodeunit.js');
|
|
|
|
var test = tap4nodeunit.test;
|
|
|
|
|
2014-06-01 05:57:36 +00:00
|
|
|
var nodeVer = process.versions.node.split('.').map(Number);
|
|
|
|
|
|
|
|
if (nodeVer[0] <= 0 && nodeVer[1] <= 8) {
|
|
|
|
console.warn('skip test (node <= 0.8)');
|
|
|
|
} else {
|
2014-06-01 06:00:13 +00:00
|
|
|
test('log with rotating file stream will terminate', function (t) {
|
2014-06-01 05:57:36 +00:00
|
|
|
exec('node ' +__dirname + '/process-exit.js', {timeout: 1000},
|
|
|
|
function (err, stdout, stderr) {
|
|
|
|
t.ifError(err);
|
|
|
|
t.equal(stdout, 'done\n');
|
|
|
|
t.equal(stderr, '');
|
|
|
|
t.end();
|
|
|
|
});
|
2014-06-01 05:25:06 +00:00
|
|
|
});
|
2014-06-01 05:57:36 +00:00
|
|
|
}
|