-
Notifications
You must be signed in to change notification settings - Fork 185
refactor(logger): use vitest env helpers in unit tests #4360
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
refactor(logger): use vitest env helpers in unit tests #4360
Conversation
sdangol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. Added a few minor comments.
sdangol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this @dwrth
|
This reverts commit f9ea611.



Summary
Implements Vitest environment helpers to avoid direct manipulations on
process.envChanges
process.envmanipulations with Vitest's environment helper functions:vi.stubEnv()to set environment variablesvi.unstubAllEnvs()to clear environment variablespackages/logger/tests/unit/formatters.test.tspackages/logger/tests/unit/initializeLogger.test.tspackages/logger/tests/unit/injectLambdaContext.test.tspackages/logger/tests/unit/logBuffer.test.tspackages/logger/tests/unit/logEvent.test.tspackages/logger/tests/unit/logLevels.test.tsconst ENVIRONMENT_VARIABLES = process.envstorageafterEachhooks withvi.unstubAllEnvs()process.env = {...}assignments withvi.stubEnv()beforeEachblocksIssue number: closes #4269
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.