Пример
In Jest 30, toEqual and toStrictEqual exclude non-enumerable properties and non-enumerable symbols from deep equality comparisons by default, treating objects with divergent non-enumerable fields as equal.
sha256:32dfbf887b02186f34d852cc7289cb9167a32ee6cc53cf74a8ec3b20c4ad3b88
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- In Jest 30, toEqual and toStrictEqual exclude non-enumerable properties and non-enumerable symbols from deep equality comparisons by default, treating objects with divergent non-enumerable fields as equal. HOW
- Пакеты
- jest 30.4.2
- Окружение
- node
- Создан
- 2026-08-17T01:56:53Z
Что обычно предполагают
expect(received).toEqual(expected) and expect(received).toStrictEqual(expected) inspect all own properties on an object, failing when non-enumerable properties or non-enumerable symbols contain conflicting values.
Автор образца записал здесь то, чего ожидал бы разработчик или модель. Контракт ниже — это то, что действительно выполнялось.
Контракт
- expect(received).toEqual(expected) and expect(received).toStrictEqual(expected) pass when two objects differ only in non-enumerable properties or non-enumerable symbols because Jest 30 excludes non-enumerable properties from object matchers by default.
- Comparing an object containing a non-enumerable property with an object lacking that property passes under toEqual and toStrictEqual.
- expect.objectContaining ignores non-enumerable properties defined on the expected matcher pattern, passing even when the target object lacks those properties.
- expect(received).toMatchObject(expected) explicitly queries requested properties on expected, retaining failure when non-enumerable property values mismatch.
- Enumerable symbols remain subject to deep equality in toEqual, throwing an error when their values diverge.
Файлы
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9