Repository navigation
fix(test): stub NODE_ENV in the chat utils tests instead of replacing process - #10597
Merged
Merged
Conversation
… process The test replaced the global process with a spread copy, which drops EventEmitter methods such as process.on. Since #10593 added the Blacksmith vitest plugin in CI (GITHUB_ACTIONS=true), the run calls process.on during the file and test shard 2/2 failed with "process.on is not a function". Stub only the env var, and restore it after each test.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Confidence Score: 4/5
[Low impact] The change is limited to setup and cleanup in one test suite. Remove the extra cleanup hook before merging to satisfy the repository’s testing rule. Findings
SummaryThis PR replaces the copied
Reviews (1) · Last reviewed commit: "fix(test): stub NODE_ENV in the chat uti..." · Reviewed by Greptile |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
checks / test (2/2)has failed since c01a6f4 (chore(ci): record which unit tests a change reaches, without skipping any #10593) onapp/api/chat/utils.test.ts:TypeError: process.on is not a function(all 8 tests pass; the file fails on an error outside them).vi.stubGlobal('process', { ...process, env: {...} }); spreadingprocessdrops its EventEmitter methods. chore(ci): record which unit tests a change reaches, without skipping any #10593's Blacksmith vitest plugin (CI only,GITHUB_ACTIONS=true) callsprocess.onduring the run.vi.stubEnv('NODE_ENV', 'development')plusvi.unstubAllEnvs()after each test (the old stub was never restored either). It was the only test replacingprocess.GITHUB_ACTIONS=true: staging's version fails with the same TypeError; this version passes (8/8).