-
Notifications
You must be signed in to change notification settings - Fork 5k
test: deflake process.versions by asserting SHA shape, not exact hashes #29383
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
🟣 The file has two separate top-level
it("process.versions")blocks, producing duplicate test names that make failure reporting ambiguous. This is a pre-existing issue, but this PR modified the first block and was a natural opportunity to rename it (e.g.,it("process.versions git-hash deps")) to avoid the collision.Extended reasoning...
What the bug is: The file
test/js/node/process/process.test.jscontains two separate top-levelit("process.versions", ...)blocks with identical names. The first (line 271, modified by this PR) iterates overgitHashDepsand asserts each value matches/^[a-f0-9]{40}$/. The second (line 1179, unmodified) asserts exact semver strings likeprocess.versions.node === "24.3.0".How it manifests: Both tests run independently and currently pass. However, in bun:test output, both appear under the name
process.versions, making it impossible to distinguish which block failed from test output alone. If either block regresses, the developer sees a✗ process.versionsfailure with no way to know which of the two test bodies is the culprit without manually reading the file.Why existing code does not prevent it: bun:test does not enforce unique test names within a file, so the duplicate silently passes through. The PR modified the first block (replacing exact hash assertions with shape assertions) but did not notice or consolidate the second identically-named block.
Impact: Low functional impact — both tests run and pass today. The harm is purely in debuggability: when either block fails, engineers must manually inspect the file to determine which of the two
process.versionstests is failing. This is especially confusing given the two blocks test complementary but distinct properties.Step-by-step proof:
it("process.versions"in the file → two matches: line 271 and line 1179.bun test process.test.jswith one block forced to fail (e.g., corrupt a hash check).✗ process.versions— no indication of which block failed.How to fix: Rename the first block to
it("process.versions git-hash deps", ...)(since this PR already touches it) and optionally rename the second toit("process.versions semver fields", ...). Alternatively, consolidate both into a singleit("process.versions")block covering all assertions.