Skip to content
Closed
Changes from all commits
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
44 changes: 23 additions & 21 deletions test/js/node/process/process.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,34 +268,36 @@
expect(process.umask()).toBe(orig);
});

it("process.versions", () => {
// Expected dependency versions — must match scripts/build/deps/*.ts commits.
// These are the ACTUAL commits built into bun (not derived values, so
// bumping a dep requires updating this test too).
const expectedVersions = {
boringssl: "0c5fce43b7ed5eb6001487ee48ac65766f5ddcd1",
libarchive: "ded82291ab41d5e355831b96b0e1ff49e24d8939",
mimalloc: "9a5e1f52cdf4662f9590b69de104a4469140796f",
picohttpparser: "066d2b1e9ab820703db0837a7255d92d30f0c9f5",
zlib: "886098f3f339617b4243b286f5ed364b9989e245",
tinycc: "12882eee073cfe5c7621bcfadf679e1372d4537b",
lolhtml: "77127cd2b8545998756e8d64e36ee2313c4bb312",
ares: "3ac47ee46edd8ea40370222f91613fc16c434853",
libdeflate: "c8c56a20f8f621e6a966b716b31f1dedab6a41e3",
zstd: "f8745da6ff1ad1e7bab384bd1f9d742439278e99",
lshpack: "8905c024b6d052f083a3d11d0a169b3c2735c8a1",
};

for (const [name, expectedHash] of Object.entries(expectedVersions)) {
// Bundled C/C++ dependencies whose versions are reported as git commit
// hashes. We only assert the shape (40 lowercase hex chars) — not the
// exact hash — so dep bumps don't break this test.
const gitHashDeps = [
"boringssl",
"libarchive",
"mimalloc",
"picohttpparser",
"zlib",
"tinycc",
"lolhtml",
"ares",
"libdeflate",
"zstd",
"lshpack",
"usockets",
"uwebsockets",
"webkit",
"zig",
];

for (const name of gitHashDeps) {
expect(process.versions).toHaveProperty(name);
expect(process.versions[name]).toBe(expectedHash);
expect(process.versions[name]).toMatch(/^[a-f0-9]{40}$/);
}

expect(process.versions).toHaveProperty("usockets");
expect(process.versions).toHaveProperty("uwebsockets");
expect(process.versions.usockets).toBe(process.versions.uwebsockets);
});

Check notice on line 300 in test/js/node/process/process.test.js

View check run for this annotation

Claude / Claude Code Review

Duplicate it("process.versions") test name

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.
Comment on lines 271 to 300

Copy link
Copy Markdown
Contributor

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.js contains two separate top-level it("process.versions", ...) blocks with identical names. The first (line 271, modified by this PR) iterates over gitHashDeps and asserts each value matches /^[a-f0-9]{40}$/. The second (line 1179, unmodified) asserts exact semver strings like process.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.versions failure 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.versions tests is failing. This is especially confusing given the two blocks test complementary but distinct properties.

Step-by-step proof:

  1. Grep it("process.versions" in the file → two matches: line 271 and line 1179.
  2. Run bun test process.test.js with one block forced to fail (e.g., corrupt a hash check).
  3. Output shows ✗ process.versions — no indication of which block failed.
  4. Developer must manually inspect both blocks to locate the regression.

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 to it("process.versions semver fields", ...). Alternatively, consolidate both into a single it("process.versions") block covering all assertions.

it("process.config", () => {
expect(process.config.variables.clang).toBeNumber();
expect(process.config.variables.host_arch).toBeDefined();
Expand Down
Loading