enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.95k stars 2.01k forks source link

Fix `simulateError()` on Memo component #2525

Closed henryqdineen closed 3 years ago

henryqdineen commented 3 years ago

We are seeing TypeError: Cannot read property 'displayNameOfNode' of undefined errors and I believe I tracked it down to a regression introduced in https://github.com/enzymejs/enzyme/pull/2482. The displayNameOfNode() method now references this but with simulateError() it ends up being called unbound. My fix is to just always bind adapter.displayNameOfNode so this is always adapter.

Thanks!

codecov[bot] commented 3 years ago

Codecov Report

Merging #2525 (8c55734) into master (f046079) will increase coverage by 0.00%. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2525   +/-   ##
=======================================
  Coverage   96.31%   96.31%           
=======================================
  Files          49       49           
  Lines        4204     4207    +3     
  Branches     1130     1130           
=======================================
+ Hits         4049     4052    +3     
  Misses        155      155           
Impacted Files Coverage Δ
...enzyme-adapter-react-16/src/ReactSixteenAdapter.js 95.46% <ø> (ø)
...e-adapter-react-16.1/src/ReactSixteenOneAdapter.js 95.03% <0.00%> (-0.02%) :arrow_down:
...e-adapter-react-16.2/src/ReactSixteenTwoAdapter.js 95.09% <0.00%> (-0.02%) :arrow_down:
...adapter-react-16.3/src/ReactSixteenThreeAdapter.js 95.45% <0.00%> (-0.02%) :arrow_down:
packages/enzyme/src/ShallowWrapper.js 99.12% <0.00%> (+<0.01%) :arrow_up:
packages/enzyme/src/selectors.js 96.46% <0.00%> (+0.01%) :arrow_up:
...nzyme-adapter-react-13/src/ReactThirteenAdapter.js 94.96% <0.00%> (+0.03%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f046079...8c55734. Read the comment docs.