mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
33 lines
711 B
JavaScript
33 lines
711 B
JavaScript
'use strict';
|
|
|
|
const test = require('tap').test;
|
|
const layouts = require('../../lib/layouts');
|
|
const sandbox = require('sandboxed-module');
|
|
|
|
test('log4js console appender', (batch) => {
|
|
batch.test('should output to console', (t) => {
|
|
const messages = [];
|
|
const fakeConsole = {
|
|
log: function (msg) {
|
|
messages.push(msg);
|
|
}
|
|
};
|
|
const appenderModule = sandbox.require(
|
|
'../../lib/appenders/console',
|
|
{
|
|
globals: {
|
|
console: fakeConsole
|
|
}
|
|
}
|
|
);
|
|
|
|
const appender = appenderModule.appender(layouts.messagePassThroughLayout);
|
|
appender({ data: ['blah'] });
|
|
|
|
t.equal(messages[0], 'blah');
|
|
t.end();
|
|
});
|
|
|
|
batch.end();
|
|
});
|