enzymejs / enzyme

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

Fix: setContext doesn't trigger componentWillReceiveProps #2476

Closed mul53 closed 3 years ago

mul53 commented 3 years ago

Fixes #2258

Below are two code sandboxes that show the bug exists, i added enzyme to the sandbox when you run the tests sandbox 2 doesn't call the method while sandbox 1 does.

mul53 commented 3 years ago

@ljharb Here are the sandboxes

React 0.14 Sandbox React 15 Sandbox React 16.2 Sandbox React 16.3 Sandbox React 16.4 Sandbox

I will continue looking at the issue

codecov[bot] commented 3 years ago

Codecov Report

Merging #2476 (76e0109) into master (2dbc816) will increase coverage by 0.07%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2476      +/-   ##
==========================================
+ Coverage   96.05%   96.13%   +0.07%     
==========================================
  Files          49       49              
  Lines        3925     4006      +81     
  Branches     1102     1123      +21     
==========================================
+ Hits         3770     3851      +81     
  Misses        155      155              
Impacted Files Coverage Δ
...nzyme-adapter-react-14/src/ReactFourteenAdapter.js 96.45% <100.00%> (+0.55%) :arrow_up:
...e-adapter-react-16.1/src/ReactSixteenOneAdapter.js 94.86% <100.00%> (+0.34%) :arrow_up:
...e-adapter-react-16.2/src/ReactSixteenTwoAdapter.js 94.88% <100.00%> (+0.32%) :arrow_up:
...adapter-react-16.3/src/ReactSixteenThreeAdapter.js 95.25% <100.00%> (+0.27%) :arrow_up:
...enzyme-adapter-react-16/src/ReactSixteenAdapter.js 95.32% <100.00%> (+0.16%) :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 2dbc816...34828de. Read the comment docs.