Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Modify BaseExceptionFilter to include error properties in error logging #13681

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test(core): modify error method test case
  • Loading branch information
jochongs committed Jun 13, 2024
commit 06027c1d404dda8f3d858ae6e331e9bfa65da36e
9 changes: 5 additions & 4 deletions packages/common/test/services/logger.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ describe('Logger', () => {
describe('when the default logger is used', () => {
let processStdoutWriteSpy: sinon.SinonSpy;
let processStderrWriteSpy: sinon.SinonSpy;
let consoleErrorSpy: sinon.SinonSpy;

beforeEach(() => {
processStdoutWriteSpy = sinon.spy(process.stdout, 'write');
processStderrWriteSpy = sinon.spy(process.stderr, 'write');
consoleErrorSpy = sinon.spy(console, 'error');
});

afterEach(() => {
processStdoutWriteSpy.restore();
processStderrWriteSpy.restore();
consoleErrorSpy.restore();
});

it('should print one message to the console', () => {
Expand Down Expand Up @@ -111,10 +114,8 @@ describe('Logger', () => {

Logger.error(error);

expect(processStderrWriteSpy.calledOnce).to.be.true;
expect(processStderrWriteSpy.firstCall.firstArg).to.include(
`Error: Random text here`,
);
expect(consoleErrorSpy.calledOnce).to.be.true;
expect(consoleErrorSpy.firstCall.firstArg).to.equal(error);
});

it('should serialise a plain JS object (as a message) without context to the console', () => {
Expand Down