Skip to content

Commit

Permalink
fix: fix child logger unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoyi Chen committed Jun 10, 2020
1 parent 963b696 commit 93da343
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/unit/loggerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ describe('Logger', () => {
it('should log uncaught exception in root logger', async () => {
process.env.SFDX_ENV = 'dev';

$$.SANDBOX.stub(Logger.prototype, 'fatal');
const rootLogger = await Logger.root();
$$.SANDBOX.stub(rootLogger, 'fatal');

// @ts-ignore
Logger.lifecycle.emit('uncaughtException', 'testException');
Expand All @@ -181,13 +181,13 @@ describe('Logger', () => {
it('should not log uncaught exception in child logger', async () => {
process.env.SFDX_ENV = 'dev';

$$.SANDBOX.stub(Logger.prototype, 'fatal');
const childLoggerName = 'myChildLogger';
const childLogger = await Logger.child(childLoggerName);
$$.SANDBOX.stub(childLogger, 'fatal');

// @ts-ignore
Logger.lifecycle.emit('uncaughtException', 'testException');
expect(childLogger.fatal['called']).to.be.true;
expect(childLogger.fatal['called']).to.be.false;
});
});

Expand Down

0 comments on commit 93da343

Please sign in to comment.