First Commit of new way of building the Platform
This commit is contained in:
1 parent
e48cf0dae5
commit
40e60b42cc
4616 files changed
+713402
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
describe('diagnostics', function () {
|
||||
'use strict';
|
||||
|
||||
var assume = require('assume')
|
||||
, debug = require('./');
|
||||
|
||||
beforeEach(function () {
|
||||
process.env.DEBUG = '';
|
||||
process.env.DIAGNOSTICS = '';
|
||||
});
|
||||
|
||||
it('is exposed as function', function () {
|
||||
assume(debug).to.be.a('function');
|
||||
});
|
||||
|
||||
it('stringifies objects', function (next) {
|
||||
process.env.DEBUG = 'test';
|
||||
|
||||
debug.to({
|
||||
write: function write(line) {
|
||||
assume(line).to.contain('test');
|
||||
assume(line).to.contain('I will be readable { json: 1 }');
|
||||
|
||||
debug.to(process.stdout);
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
debug('test')('I will be readable', { json: 1 });
|
||||
});
|
||||
|
||||
describe('.to', function () {
|
||||
it('globally overrides the stream', function (next) {
|
||||
process.env.DEBUG = 'foo';
|
||||
|
||||
debug.to({
|
||||
write: function write(line) {
|
||||
assume(line).to.contain('foo');
|
||||
assume(line).to.contain('bar');
|
||||
|
||||
debug.to(process.stdout);
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
var log = debug('foo');
|
||||
log('bar');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user