-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityloggerThis item relates to the Logger UtilityThis item relates to the Logger Utility
Description
Description of the feature request
Problem statement
While running jest I would like to suppress the logs on the console to make it readable and clean.
jest CLI is offering --silent
option to prevent tests from printing messages through the console, but it doesn't seem to work with the logger.
Summary of the feature
Suggestions:
- the logger is silenced when running in jest with
--silent
- the logger is disabled when running in the test environment or when
NODE_ENV
is atest
- an option on the constructor to disable the logger
Code examples
jest --silent
Benefits for you and the wider AWS community
make the console readable and clean while running tests.
Describe alternatives you've considered
I have created a __mocks__/@aws-lambda-powertools/logger.ts
with this setup
export const Logger = jest.fn().mockImplementation(() => {
return {
debug: () => jest.fn(),
info: () => jest.fn(),
error: () => jest.fn(),
};
});
and this solves the issue.
Additional context
Related issues, RFCs
ptejada, nathanagez and paulmis
Metadata
Metadata
Assignees
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityloggerThis item relates to the Logger UtilityThis item relates to the Logger Utility