describe('Log.format.color', function () { let formatter; before(function () { formatter = Log.format.color(); }); it('color formats message', function () { const colored = formatter.transform({ message: '%c I will be red %c', [SPLAT]: ['color: #FF0000'] }); assume(colored.message).to.equal('\x1b[38;5;196m I will be red \x1b[39;49m'); assume(colored.meta).to.have.length(0); }); it('can handle unclosed coloring tokens', function () { const colored = formatter.transform({ message: '%c I will still work and be blue', [SPLAT]: ['color: #0000FF'] }); assume(colored.message).to.equal('\x1b[38;5;21m I will still work and be blue\x1b[39;49m'); assume(colored.meta).to.have.length(0); }); });
assume(formatters).to.have.property('options'); assume(spy.getCall(0).args).to.deep.equal([ Log.format.color(), format.colorize(), format.splat(),
describe('Log.format.color', function () { let formatter; before(function () { formatter = Log.format.color(); }); it('color formats message', function () { const colored = formatter.transform({ message: '%c I will be red %c', [SPLAT]: ['color: #FF0000'] }); assume(colored.message).to.equal('\x1b[38;5;196m I will be red \x1b[39;49m'); assume(colored.meta).to.have.length(0); }); it('can handle unclosed coloring tokens', function () { const colored = formatter.transform({ message: '%c I will still work and be blue', [SPLAT]: ['color: #0000FF'] }); assume(colored.message).to.equal('\x1b[38;5;21m I will still work and be blue\x1b[39;49m'); assume(colored.meta).to.have.length(0); }); });
assume(formatters).to.have.property('options'); assume(spy.getCall(0).args).to.deep.equal([ Log.format.color(), format.colorize(), format.splat(),