Skip to content

v0.2.13

@greg-flux greg-flux tagged this 13 Jun 21:21
`deepEqual` compared raw `Object.keys().length`, so a received object carrying
an explicit-`undefined` own property (e.g. `{ importTemplateId: undefined, ... }`)
failed `toEqual` / `toHaveBeenCalledWith` against an expectation that omitted the
key — contrary to jest/vitest, which treat an `undefined`-valued own property as
absent. Because the `undefined` value isn't rendered, the printed `expected` and
`received` came out byte-identical, making the failure look impossible.

Reported as a shard/worker state leak (BUG-equality-state-leak-across-shard-files.md),
but the defect is deterministic: it fires whenever the received object has an
explicit-`undefined` key. It only looked order-dependent because whether that key
was present depended on which code path earlier files exercised.

- deepEqual gains a `strict` flag. Default (toEqual/toHaveBeenCalledWith/...) drops
  own keys whose value is `undefined` on both sides before comparing.
- toStrictEqual passes strict=true → keeps undefined-valued keys significant.
- Array elements are never stripped in either mode: [1, undefined] != [1].

Bumps version to 0.2.13 (package.json + Cargo.toml) and adds a CHANGELOG entry,
now mandatory for every tagged release per CLAUDE.md.

Regression: fixtures/tests/equality-undefined-strip.test.mjs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assets 2
Loading