From 8cc5d3c3b722af57fd3e8bb7efc1329b6e8d3ff5 Mon Sep 17 00:00:00 2001 From: D-Sketon <2055272094@qq.com> Date: Mon, 11 Sep 2023 20:09:41 +0800 Subject: [PATCH] test: improve coverage (#175) --- test/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/index.js b/test/index.js index 3ca4471..1a0fe18 100644 --- a/test/index.js +++ b/test/index.js @@ -328,6 +328,18 @@ describe('hexo-log', () => { consoleWarnSpy.args[0].length.should.eql(0); consoleErrorSpy.args[0][0].should.eql('test: %s'); }); + + it('error object with log info', () => { + const consoleInfoSpy = sinon.spy(); + + loggerModule.__set__('console.info', consoleInfoSpy); + + loggerModule.__with__(fakeProcess)(() => { + const log = loggerModule.logger(); + log.info({err: new Error('test')}); + }); + consoleInfoSpy.args[0].length.should.eql(0); + }); }); describe('hexo-log example', () => {