leoasis / redux-immutable-state-invariant

Redux middleware that detects mutations between and outside redux dispatches. For development use only.
MIT License
937 stars 37 forks source link

Issue #28: support mutation detection for iterable objects in state #35

Open darthrellimnad opened 6 years ago

darthrellimnad commented 6 years ago

I looked in to this issue a while back, but failed and put it aside for a while :). Recently I revisited this and got something working that might help resolve issue #28 .

Feel free to suggest alternate methods :). The way I found workable (while keeping backwards compatibility) was track nodes in redux state in Map objects internally by converting all Object, Arrays, and Sets to Maps when storing them in the internal "tracker" data structure (Arrays and Sets then use elt "index" as the Map "key", similar to how arrays worked before). This allows me to to treat all objects and iterables the same way when determining if a mutation has occurred.

darthrellimnad commented 6 years ago

i was having trouble running the npm run test:coverage script, i just get a message saying:

No coverage information was collected, exit without writing coverage information

...can't remember if there was a trick to running this locally? I'll want to run this in case I need to add any more cases to improve coverage.