Comments (4)
I think it makes sense to align, but I'll defer to @georgekaran
from jest.
Hey @stephenh
Your points make a lot of sense when it comes to the SERIALIZABLE_PROPERTIES
. To be honest, maybe the name SERIALIZABLE_PROPERTIES
wasn't the best choice 😅, which might have led to some confusion as it seems to imply a broader scope than it currently has.
That being said, I think we could go to either two directions:
- Rename this property to make it clear that is only used by the diff printer;
- Apply this same variable to equality checkers.
Personally the second option makes more sense to me, but is probably gonna take a lib bit more time than just a renaming.
Let me know what you guys think, so I can start working on a draft to address this issue and aim to include it in a future pull request.
from jest.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
from jest.
It seems the misunderstanding was here:
The name SERIALIZABLE_PROPERTIES to me infers it will be used "for serialization" which I would have expected to apply to both "the toEqual check" as well as "the toEqual diff", but also
Specifically, the "toEqual check". There is no serialization there; what is being compared is the runtime values. If it weren't for that, many values that are supposed to be different would pass as equals and vice-versa.
For example, a sparse array of length 2 (Array(2)
) has the same value in all positions as an array of two undefined elements ([,,]
), but those two don't serialize to the same thing ([ <2 empty items> ]
vs [undefined, undefined]
). This even happens in other cases like objectContaining
, where the two objects being compared can be of different classes and, as such, will serialize differently while matching the test. The diff might show all the lines that are different, even though only a few of them might actually be causing the matcher to fail.
If the matcher was .serializesEquallyAs(other)
, then it would make sense to serialize the value for comparison.
from jest.
Related Issues (20)
- [Docs]: Update jest.restoreAllMocks behavior change HOT 1
- [Bug]: @jest/create-cache-key-function does not have correct type definition
- Import, export syntax error from @azure/storage-blob in nx monorepo HOT 1
- [Bug]: When executing the command npm install jest, a warning occurs HOT 1
- Jest is broken HOT 3
- [Feature]: Jest should use the `debugger` statement on failure
- [Bug]: `instanceof Date` fails when using a date created from node-api (n-api)
- [Docs]: One of the examples for configuring Jest to work with Eslint no longer works with the flat config.
- [Bug]: inflight deprecated, glob deprecated
- [Bug]: module is not mocked if there's signal input in spec file (angular)
- [Bug]: isEqual with large Float64Arrays is slow HOT 1
- [Feature]: Provide console logs per testcase to reporter
- [Bug]: require.main has invalid value null
- [Bug]: toThrow fails if error object contains a cause property
- [Feature]: add `expect(spy).toHaveResolvedWith` for spies on async functions
- [Feature]: Replace `chalk` dependency with a lighter alternative HOT 3
- [Feature]: make PRINT_LIMIT configurable
- [Feature]: Show which project failed when a `preset` fails to load HOT 1
- [Bug]: Calling ts.createSourceFile in a test file hangs with Typescript 5.x.x
- [Bug]: [jest-runner] loses error `stack` property for failed test when sends a message to jest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest.