Cannot assign to read only property '...' of object '...'
See original GitHub issueš Bug Report
Manually transferring https://github.com/facebook/react/issues/18758 to here. During debugging, it was determined to be a Jest issue.
@gaearon rightly agreed with me that the issue wonāt get fixed by sitting in the React repo. But they used their facebook
admin powers to lock the issue, instead of using GitHubās āTransfer Issueā feature to get it here with all its detail in an instant. Ah, well.
People (including React repo maintainers, apparently) are seeing variations on TypeError: Cannot assign to read only property 'Symbol(...)' of object '[object ...]'
when they do expect(...).toBe(...)
and expect(...).toEqual(...)
.
The initial response is that itās not a very helpful error message.
Hereās one clue that might explain it:
It happens when calling
replaceMatchedToAsymmetricMatcher()
insideprintDiffOrStringify()
https://github.com/facebook/jest/blob/master/packages/jest-matcher-utils/src/index.ts#L359
@SimenB any ideas?
_Originally posted by @pahan35 in https://github.com/facebook/react/issues/18758#issuecomment-636249433_
And a suggestion about what should be done about it:
We see a current message because
replaceMatchedToAsymmetricMatcher
fails on preparing the diff.IMHO itās not about improving the error message, itās about fixing
replaceMatchedToAsymmetricMatcher
to print the diff for DOM elements without failures.
_Originally posted by @pahan35 in https://github.com/facebook/react/issues/18758#issuecomment-647179531_
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
https://github.com/microsoft/TypeScript/issues/1863 Probably related to the error
Sorry guys. Iām trying to figure out the problem and solve it.