Omit non-enumerable, symbolic members in snapshots
See original GitHub issue🐛 Bug Report
When upgrading from MobX 4.3.0 to 5.6.0, new snapshot information is created using jest
This information is largely extraneous, and when added typically triples the size of the snapshot file (best case) and sometimes grows file by 10x (worst case)
exports[`Size Picker Snapshot not clicked 1`] = `
<MuiThemeProvider>
<SizePicker
store={
SizePickerStore {
"defaultValue": 8,
"idPrefix": "size-picker",
"internalId": "1",
"isExpanded": false,
"isMousePressed": false,
"label": undefined,
"onChange": Event {
"listeners": Array [],
"publishRecursionCount": 0,
},
"onHideShow": [Function],
"onKeyDown": [Function],
"onMouseDown": [Function],
"onMouseUp": [Function],
"value": 8,
+ Symbol(mobx did run lazy initializers): true,
+ Symbol(mobx administration): ObservableObjectAdministration$$1 {
+ "defaultEnhancer": [Function],
+ "keysAtom": Atom$$1 {
+ "diffValue": 0,
+ "isBeingObserved": false,
+ "isPendingUnobservation": false,
+ "lastAccessedBy": 0,
+ "lowestObserverState": 2,
+ "name": "SizePickerStore@26.keys",
+ "observers": Set {},
},
"name": "SizePickerStore@26",
"target": [Circular],
"values": Map {
"value" => 8,
"isExpanded" => false,
"label" => undefined,
},
},
}
}
>
To Reproduce
Steps to reproduce the behavior: Using mobx and mobx-react, create an @observer
react component that receives props including an @observable
object. Write a test file that mounts this component and takes a snapshot
Expected behavior
according to @mweststrate of MobX:
the problem is that it should ignore non-enumerable (symbolic) members. It was fixed a while ago for toEqual, but not yet for snapshots
Run npx envinfo --preset jest
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Binaries:
Node: 10.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.0.4 - C:\Program Files\nodejs\npm.CMD
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Enumerability and ownership of properties - JavaScript | MDN
Every property in JavaScript objects can be classified by three factors: Enumerable or non-enumerable;; String or symbol;; Own property or ...
Read more >jest-snapshot | Yarn - Package Manager
... [jest-haste-map] [BREAKING] Recover files correctly after haste name collisions are fixed (#7329); [pretty-format] [BREAKING] Omit non-enumerable symbol ...
Read more >Web IDL Standard
An interface is a specification of a set of interface members (matching ... the ArgumentNameKeyword symbol without needing to escape it.
Read more >ECMAScript® 2023 Language Specification - TC39
A primitive value is a member of one of the following built-in types: Undefined, Null, Boolean, Number, BigInt, String, and Symbol; an object...
Read more >Safari Technology Preview Release Notes - Apple Developer
Added support for Symbolic Breakpoints (253374@main, 253791@main) ... Send notifications to people who opt-in on your website or web app with Safari ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Suggested alternative title for this issue: Omit non-enumerable, symbolic members in snapshots
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.