{"record":{"id":"3b74d24e14c7e977","repo":"oven-sh/bun","slug":"expected-expected-to-be-equal-for-descript","errorCode":null,"errorMessage":"Expected ${expected} to be ${equal} for ${description}","messagePattern":"Expected (.+?) to be (.+?) for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/snippets/deep-equals.js","lineNumber":496,"sourceCode":"            subProp1: \"sub value1\",\n          },\n        },\n        equal: true,\n      },\n    ],\n  },\n];\n\nfor (let { tests, description } of fixture) {\n  // if (description === \"sample objects\") {\n  for (let { description: describe, value1, value2, equal } of tests) {\n    var expected;\n    group(describe, () => {\n      for (let equalsFn of [Bun.deepEquals, fastDeepEquals]) {\n        bench(`${describe}: ${equalsFn.name}`, () => {\n          expected = equalsFn(value1, value2);\n          if (expected !== equal) {\n            throw new Error(`Expected ${expected} to be ${equal} for ${description}`);\n          }\n        });\n      }\n    });\n    // }\n  }\n}\n\nawait run();\n","sourceCodeStart":478,"sourceCodeEnd":506,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/snippets/deep-equals.js#L478-L506","documentation":"Assertion in the deep-equals benchmark fixture runner. Each fixture pair (value1, value2, equal) is run through both Bun.deepEquals and fastDeepEquals; if the returned boolean differs from the fixture's expected `equal` flag, this error names the mismatch. It signals a deep-equality false positive or false negative — or a fixture whose expected flag is wrong.","triggerScenarios":"Executing bench/snippets/deep-equals.js and hitting a fixture pair whose semantics are subtle: typed arrays, boxed primitives, NaN/-0, prototypes, getters, Symbol keys, sparse arrays, cross-realm objects — cases where Bun.deepEquals disagrees with the fixture's ground truth.","commonSituations":"A change to Bun.deepEquals breaking a corner case; adding a new fixture entry with an incorrect `equal` value; upgrading the fast-deep-equal dependency so the two implementations diverge on a fixture.","solutions":["Read the error to get `description` (fixture group) and the bench group name printed around it to identify the exact pair","Extract that pair into a small script and compare against Node's ground truth: util.isDeepStrictEqual(value1, value2)","If Node agrees with the fixture, fix the Bun.deepEquals branch that mishandles the case; if Node disagrees, correct the fixture's `equal` flag","Re-run the bench to confirm all fixture pairs pass"],"exampleFix":"// before (fixture claims unequal, Bun.deepEquals returns true)\n{ value1: objA, value2: objB, equal: false }\n// after (verify ground truth first, then align)\nconst { isDeepStrictEqual } = require('node:util');\nconsole.log(isDeepStrictEqual(objA, objB)); // set fixture `equal` to this result","handlingStrategy":"validation","validationCode":"// before adding a fixture pair, pin ground truth with Node\nconst { isDeepStrictEqual } = require('node:util');\n// equal: isDeepStrictEqual(value1, value2)  <- use this result","typeGuard":null,"tryCatchPattern":"// keep the bench's failure informative\ntry {\n  const got = equalsFn(value1, value2);\n  if (got !== equal) console.error(`${equalsFn.name} said ${got}, expected ${equal} for ${describe}`);\n} catch (e) {\n  console.error(`${equalsFn.name} threw on ${describe}:`, e);\n}","preventionTips":["Cross-check every new deep-equals fixture against util.isDeepStrictEqual (or another trusted oracle) before committing the expected flag","When changing Bun.deepEquals, run the deep-equals bench as a conformance smoke test, not just the unit tests","Name fixture groups precisely so the error's `description` field immediately identifies the failing pair"],"tags":["deep-equals","equality","benchmark","assertion","fixtures"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}