Added a test for added/removed props
Brian Vaughn committed
Jun 8, 2019 at 11:41 UTC
6ab522326d971de99e6e6a751661608402e92b08
2 files changed
+1044
-4
src/__tests__/__snapshots__/profilingCache-test.js.snap
+1033
@@ -1907,6 +1907,1039 @@ Object {
1907
}
1908
`;
1909
1910
+exports[`ProfilingCache should record changed props/state/context/hooks: CommitDetails commitIndex: 0 1`] = `
1911
+Object {
1912
+ "changeDescriptions": Map {},
1913
+ "duration": 0,
1914
+ "fiberActualDurations": Map {
1915
+ 1 => 0,
1916
+ 2 => 0,
1917
+ 3 => 0,
1918
+ 4 => 0,
1919
+ 5 => 0,
1920
+ 6 => 0,
1921
+ 7 => 0,
1922
+ },
1923
+ "fiberSelfDurations": Map {
1924
+ 1 => 0,
1925
+ 2 => 0,
1926
+ 3 => 0,
1927
+ 4 => 0,
1928
+ 5 => 0,
1929
+ 6 => 0,
1930
+ 7 => 0,
1931
+ },
1932
+ "interactionIDs": Array [],
1933
+ "priorityLevel": "Immediate",
1934
+ "screenshot": null,
1935
+ "timestamp": 0,
1936
+}
1937
+`;
1938
+
1939
+exports[`ProfilingCache should record changed props/state/context/hooks: CommitDetails commitIndex: 1 1`] = `
1940
+Object {
1941
+ "changeDescriptions": Map {
1942
+ 5 => Object {
1943
+ "context": null,
1944
+ "didHooksChange": true,
1945
+ "props": Array [
1946
+ "count",
1947
+ ],
1948
+ "state": null,
1949
+ },
1950
+ 4 => Object {
1951
+ "context": true,
1952
+ "didHooksChange": false,
1953
+ "props": Array [],
1954
+ "state": null,
1955
+ },
1956
+ 7 => Object {
1957
+ "context": null,
1958
+ "didHooksChange": true,
1959
+ "props": Array [
1960
+ "count",
1961
+ ],
1962
+ "state": null,
1963
+ },
1964
+ 6 => Object {
1965
+ "context": Array [
1966
+ "count",
1967
+ ],
1968
+ "didHooksChange": false,
1969
+ "props": Array [],
1970
+ "state": null,
1971
+ },
1972
+ 2 => Object {
1973
+ "context": null,
1974
+ "didHooksChange": false,
1975
+ "props": Array [],
1976
+ "state": Array [
1977
+ "count",
1978
+ ],
1979
+ },
1980
+ },
1981
+ "duration": 0,
1982
+ "fiberActualDurations": Map {
1983
+ 5 => 0,
1984
+ 4 => 0,
1985
+ 7 => 0,
1986
+ 6 => 0,
1987
+ 3 => 0,
1988
+ 2 => 0,
1989
+ },
1990
+ "fiberSelfDurations": Map {
1991
+ 5 => 0,
1992
+ 4 => 0,
1993
+ 7 => 0,
1994
+ 6 => 0,
1995
+ 3 => 0,
1996
+ 2 => 0,
1997
+ },
1998
+ "interactionIDs": Array [],
1999
+ "priorityLevel": "Immediate",
2000
+ "screenshot": null,
2001
+ "timestamp": 0,
2002
+}
2003
+`;
2004
+
2005
+exports[`ProfilingCache should record changed props/state/context/hooks: CommitDetails commitIndex: 2 1`] = `
2006
+Object {
2007
+ "changeDescriptions": Map {
2008
+ 5 => Object {
2009
+ "context": null,
2010
+ "didHooksChange": false,
2011
+ "props": Array [],
2012
+ "state": null,
2013
+ },
2014
+ 4 => Object {
2015
+ "context": false,
2016
+ "didHooksChange": false,
2017
+ "props": Array [],
2018
+ "state": null,
2019
+ },
2020
+ 7 => Object {
2021
+ "context": null,
2022
+ "didHooksChange": false,
2023
+ "props": Array [],
2024
+ "state": null,
2025
+ },
2026
+ 6 => Object {
2027
+ "context": Array [],
2028
+ "didHooksChange": false,
2029
+ "props": Array [],
2030
+ "state": null,
2031
+ },
2032
+ 2 => Object {
2033
+ "context": null,
2034
+ "didHooksChange": false,
2035
+ "props": Array [
2036
+ "foo",
2037
+ ],
2038
+ "state": Array [],
2039
+ },
2040
+ },
2041
+ "duration": 0,
2042
+ "fiberActualDurations": Map {
2043
+ 5 => 0,
2044
+ 4 => 0,
2045
+ 7 => 0,
2046
+ 6 => 0,
2047
+ 3 => 0,
2048
+ 2 => 0,
2049
+ 1 => 0,
2050
+ },
2051
+ "fiberSelfDurations": Map {
2052
+ 5 => 0,
2053
+ 4 => 0,
2054
+ 7 => 0,
2055
+ 6 => 0,
2056
+ 3 => 0,
2057
+ 2 => 0,
2058
+ 1 => 0,
2059
+ },
2060
+ "interactionIDs": Array [],
2061
+ "priorityLevel": "Immediate",
2062
+ "screenshot": null,
2063
+ "timestamp": 0,
2064
+}
2065
+`;
2066
+
2067
+exports[`ProfilingCache should record changed props/state/context/hooks: CommitDetails commitIndex: 3 1`] = `
2068
+Object {
2069
+ "changeDescriptions": Map {
2070
+ 5 => Object {
2071
+ "context": null,
2072
+ "didHooksChange": false,
2073
+ "props": Array [],
2074
+ "state": null,
2075
+ },
2076
+ 4 => Object {
2077
+ "context": false,
2078
+ "didHooksChange": false,
2079
+ "props": Array [],
2080
+ "state": null,
2081
+ },
2082
+ 7 => Object {
2083
+ "context": null,
2084
+ "didHooksChange": false,
2085
+ "props": Array [],
2086
+ "state": null,
2087
+ },
2088
+ 6 => Object {
2089
+ "context": Array [],
2090
+ "didHooksChange": false,
2091
+ "props": Array [],
2092
+ "state": null,
2093
+ },
2094
+ 2 => Object {
2095
+ "context": null,
2096
+ "didHooksChange": false,
2097
+ "props": Array [
2098
+ "foo",
2099
+ "bar",
2100
+ ],
2101
+ "state": Array [],
2102
+ },
2103
+ },
2104
+ "duration": 0,
2105
+ "fiberActualDurations": Map {
2106
+ 5 => 0,
2107
+ 4 => 0,
2108
+ 7 => 0,
2109
+ 6 => 0,
2110
+ 3 => 0,
2111
+ 2 => 0,
2112
+ 1 => 0,
2113
+ },
2114
+ "fiberSelfDurations": Map {
2115
+ 5 => 0,
2116
+ 4 => 0,
2117
+ 7 => 0,
2118
+ 6 => 0,
2119
+ 3 => 0,
2120
+ 2 => 0,
2121
+ 1 => 0,
2122
+ },
2123
+ "interactionIDs": Array [],
2124
+ "priorityLevel": "Immediate",
2125
+ "screenshot": null,
2126
+ "timestamp": 0,
2127
+}
2128
+`;
2129
+
2130
+exports[`ProfilingCache should record changed props/state/context/hooks: CommitDetails commitIndex: 4 1`] = `
2131
+Object {
2132
+ "changeDescriptions": Map {
2133
+ 5 => Object {
2134
+ "context": null,
2135
+ "didHooksChange": false,
2136
+ "props": Array [],
2137
+ "state": null,
2138
+ },
2139
+ 4 => Object {
2140
+ "context": false,
2141
+ "didHooksChange": false,
2142
+ "props": Array [],
2143
+ "state": null,
2144
+ },
2145
+ 7 => Object {
2146
+ "context": null,
2147
+ "didHooksChange": false,
2148
+ "props": Array [],
2149
+ "state": null,
2150
+ },
2151
+ 6 => Object {
2152
+ "context": Array [],
2153
+ "didHooksChange": false,
2154
+ "props": Array [],
2155
+ "state": null,
2156
+ },
2157
+ 2 => Object {
2158
+ "context": null,
2159
+ "didHooksChange": false,
2160
+ "props": Array [
2161
+ "bar",
2162
+ ],
2163
+ "state": Array [],
2164
+ },
2165
+ },
2166
+ "duration": 0,
2167
+ "fiberActualDurations": Map {
2168
+ 5 => 0,
2169
+ 4 => 0,
2170
+ 7 => 0,
2171
+ 6 => 0,
2172
+ 3 => 0,
2173
+ 2 => 0,
2174
+ 1 => 0,
2175
+ },
2176
+ "fiberSelfDurations": Map {
2177
+ 5 => 0,
2178
+ 4 => 0,
2179
+ 7 => 0,
2180
+ 6 => 0,
2181
+ 3 => 0,
2182
+ 2 => 0,
2183
+ 1 => 0,
2184
+ },
2185
+ "interactionIDs": Array [],
2186
+ "priorityLevel": "Immediate",
2187
+ "screenshot": null,
2188
+ "timestamp": 0,
2189
+}
2190
+`;
2191
+
2192
+exports[`ProfilingCache should record changed props/state/context/hooks: imported data 1`] = `
2193
+Object {
2194
+ "dataForRoots": Array [
2195
+ Object {
2196
+ "commitData": Array [
2197
+ Object {
2198
+ "changeDescriptions": Array [],
2199
+ "duration": 0,
2200
+ "fiberActualDurations": Array [
2201
+ Array [
2202
+ 1,
2203
+ 0,
2204
+ ],
2205
+ Array [
2206
+ 2,
2207
+ 0,
2208
+ ],
2209
+ Array [
2210
+ 3,
2211
+ 0,
2212
+ ],
2213
+ Array [
2214
+ 4,
2215
+ 0,
2216
+ ],
2217
+ Array [
2218
+ 5,
2219
+ 0,
2220
+ ],
2221
+ Array [
2222
+ 6,
2223
+ 0,
2224
+ ],
2225
+ Array [
2226
+ 7,
2227
+ 0,
2228
+ ],
2229
+ ],
2230
+ "fiberSelfDurations": Array [
2231
+ Array [
2232
+ 1,
2233
+ 0,
2234
+ ],
2235
+ Array [
2236
+ 2,
2237
+ 0,
2238
+ ],
2239
+ Array [
2240
+ 3,
2241
+ 0,
2242
+ ],
2243
+ Array [
2244
+ 4,
2245
+ 0,
2246
+ ],
2247
+ Array [
2248
+ 5,
2249
+ 0,
2250
+ ],
2251
+ Array [
2252
+ 6,
2253
+ 0,
2254
+ ],
2255
+ Array [
2256
+ 7,
2257
+ 0,
2258
+ ],
2259
+ ],
2260
+ "interactionIDs": Array [],
2261
+ "priorityLevel": "Immediate",
2262
+ "screenshot": null,
2263
+ "timestamp": 0,
2264
+ },
2265
+ Object {
2266
+ "changeDescriptions": Array [
2267
+ Array [
2268
+ 5,
2269
+ Object {
2270
+ "context": null,
2271
+ "didHooksChange": true,
2272
+ "props": Array [
2273
+ "count",
2274
+ ],
2275
+ "state": null,
2276
+ },
2277
+ ],
2278
+ Array [
2279
+ 4,
2280
+ Object {
2281
+ "context": true,
2282
+ "didHooksChange": false,
2283
+ "props": Array [],
2284
+ "state": null,
2285
+ },
2286
+ ],
2287
+ Array [
2288
+ 7,
2289
+ Object {
2290
+ "context": null,
2291
+ "didHooksChange": true,
2292
+ "props": Array [
2293
+ "count",
2294
+ ],
2295
+ "state": null,
2296
+ },
2297
+ ],
2298
+ Array [
2299
+ 6,
2300
+ Object {
2301
+ "context": Array [
2302
+ "count",
2303
+ ],
2304
+ "didHooksChange": false,
2305
+ "props": Array [],
2306
+ "state": null,
2307
+ },
2308
+ ],
2309
+ Array [
2310
+ 2,
2311
+ Object {
2312
+ "context": null,
2313
+ "didHooksChange": false,
2314
+ "props": Array [],
2315
+ "state": Array [
2316
+ "count",
2317
+ ],
2318
+ },
2319
+ ],
2320
+ ],
2321
+ "duration": 0,
2322
+ "fiberActualDurations": Array [
2323
+ Array [
2324
+ 5,
2325
+ 0,
2326
+ ],
2327
+ Array [
2328
+ 4,
2329
+ 0,
2330
+ ],
2331
+ Array [
2332
+ 7,
2333
+ 0,
2334
+ ],
2335
+ Array [
2336
+ 6,
2337
+ 0,
2338
+ ],
2339
+ Array [
2340
+ 3,
2341
+ 0,
2342
+ ],
2343
+ Array [
2344
+ 2,
2345
+ 0,
2346
+ ],
2347
+ ],
2348
+ "fiberSelfDurations": Array [
2349
+ Array [
2350
+ 5,
2351
+ 0,
2352
+ ],
2353
+ Array [
2354
+ 4,
2355
+ 0,
2356
+ ],
2357
+ Array [
2358
+ 7,
2359
+ 0,
2360
+ ],
2361
+ Array [
2362
+ 6,
2363
+ 0,
2364
+ ],
2365
+ Array [
2366
+ 3,
2367
+ 0,
2368
+ ],
2369
+ Array [
2370
+ 2,
2371
+ 0,
2372
+ ],
2373
+ ],
2374
+ "interactionIDs": Array [],
2375
+ "priorityLevel": "Immediate",
2376
+ "screenshot": null,
2377
+ "timestamp": 0,
2378
+ },
2379
+ Object {
2380
+ "changeDescriptions": Array [
2381
+ Array [
2382
+ 5,
2383
+ Object {
2384
+ "context": null,
2385
+ "didHooksChange": false,
2386
+ "props": Array [],
2387
+ "state": null,
2388
+ },
2389
+ ],
2390
+ Array [
2391
+ 4,
2392
+ Object {
2393
+ "context": false,
2394
+ "didHooksChange": false,
2395
+ "props": Array [],
2396
+ "state": null,
2397
+ },
2398
+ ],
2399
+ Array [
2400
+ 7,
2401
+ Object {
2402
+ "context": null,
2403
+ "didHooksChange": false,
2404
+ "props": Array [],
2405
+ "state": null,
2406
+ },
2407
+ ],
2408
+ Array [
2409
+ 6,
2410
+ Object {
2411
+ "context": Array [],
2412
+ "didHooksChange": false,
2413
+ "props": Array [],
2414
+ "state": null,
2415
+ },
2416
+ ],
2417
+ Array [
2418
+ 2,
2419
+ Object {
2420
+ "context": null,
2421
+ "didHooksChange": false,
2422
+ "props": Array [
2423
+ "foo",
2424
+ ],
2425
+ "state": Array [],
2426
+ },
2427
+ ],
2428
+ ],
2429
+ "duration": 0,
2430
+ "fiberActualDurations": Array [
2431
+ Array [
2432
+ 5,
2433
+ 0,
2434
+ ],
2435
+ Array [
2436
+ 4,
2437
+ 0,
2438
+ ],
2439
+ Array [
2440
+ 7,
2441
+ 0,
2442
+ ],
2443
+ Array [
2444
+ 6,
2445
+ 0,
2446
+ ],
2447
+ Array [
2448
+ 3,
2449
+ 0,
2450
+ ],
2451
+ Array [
2452
+ 2,
2453
+ 0,
2454
+ ],
2455
+ Array [
2456
+ 1,
2457
+ 0,
2458
+ ],
2459
+ ],
2460
+ "fiberSelfDurations": Array [
2461
+ Array [
2462
+ 5,
2463
+ 0,
2464
+ ],
2465
+ Array [
2466
+ 4,
2467
+ 0,
2468
+ ],
2469
+ Array [
2470
+ 7,
2471
+ 0,
2472
+ ],
2473
+ Array [
2474
+ 6,
2475
+ 0,
2476
+ ],
2477
+ Array [
2478
+ 3,
2479
+ 0,
2480
+ ],
2481
+ Array [
2482
+ 2,
2483
+ 0,
2484
+ ],
2485
+ Array [
2486
+ 1,
2487
+ 0,
2488
+ ],
2489
+ ],
2490
+ "interactionIDs": Array [],
2491
+ "priorityLevel": "Immediate",
2492
+ "screenshot": null,
2493
+ "timestamp": 0,
2494
+ },
2495
+ Object {
2496
+ "changeDescriptions": Array [
2497
+ Array [
2498
+ 5,
2499
+ Object {
2500
+ "context": null,
2501
+ "didHooksChange": false,
2502
+ "props": Array [],
2503
+ "state": null,
2504
+ },
2505
+ ],
2506
+ Array [
2507
+ 4,
2508
+ Object {
2509
+ "context": false,
2510
+ "didHooksChange": false,
2511
+ "props": Array [],
2512
+ "state": null,
2513
+ },
2514
+ ],
2515
+ Array [
2516
+ 7,
2517
+ Object {
2518
+ "context": null,
2519
+ "didHooksChange": false,
2520
+ "props": Array [],
2521
+ "state": null,
2522
+ },
2523
+ ],
2524
+ Array [
2525
+ 6,
2526
+ Object {
2527
+ "context": Array [],
2528
+ "didHooksChange": false,
2529
+ "props": Array [],
2530
+ "state": null,
2531
+ },
2532
+ ],
2533
+ Array [
2534
+ 2,
2535
+ Object {
2536
+ "context": null,
2537
+ "didHooksChange": false,
2538
+ "props": Array [
2539
+ "foo",
2540
+ "bar",
2541
+ ],
2542
+ "state": Array [],
2543
+ },
2544
+ ],
2545
+ ],
2546
+ "duration": 0,
2547
+ "fiberActualDurations": Array [
2548
+ Array [
2549
+ 5,
2550
+ 0,
2551
+ ],
2552
+ Array [
2553
+ 4,
2554
+ 0,
2555
+ ],
2556
+ Array [
2557
+ 7,
2558
+ 0,
2559
+ ],
2560
+ Array [
2561
+ 6,
2562
+ 0,
2563
+ ],
2564
+ Array [
2565
+ 3,
2566
+ 0,
2567
+ ],
2568
+ Array [
2569
+ 2,
2570
+ 0,
2571
+ ],
2572
+ Array [
2573
+ 1,
2574
+ 0,
2575
+ ],
2576
+ ],
2577
+ "fiberSelfDurations": Array [
2578
+ Array [
2579
+ 5,
2580
+ 0,
2581
+ ],
2582
+ Array [
2583
+ 4,
2584
+ 0,
2585
+ ],
2586
+ Array [
2587
+ 7,
2588
+ 0,
2589
+ ],
2590
+ Array [
2591
+ 6,
2592
+ 0,
2593
+ ],
2594
+ Array [
2595
+ 3,
2596
+ 0,
2597
+ ],
2598
+ Array [
2599
+ 2,
2600
+ 0,
2601
+ ],
2602
+ Array [
2603
+ 1,
2604
+ 0,
2605
+ ],
2606
+ ],
2607
+ "interactionIDs": Array [],
2608
+ "priorityLevel": "Immediate",
2609
+ "screenshot": null,
2610
+ "timestamp": 0,
2611
+ },
2612
+ Object {
2613
+ "changeDescriptions": Array [
2614
+ Array [
2615
+ 5,
2616
+ Object {
2617
+ "context": null,
2618
+ "didHooksChange": false,
2619
+ "props": Array [],
2620
+ "state": null,
2621
+ },
2622
+ ],
2623
+ Array [
2624
+ 4,
2625
+ Object {
2626
+ "context": false,
2627
+ "didHooksChange": false,
2628
+ "props": Array [],
2629
+ "state": null,
2630
+ },
2631
+ ],
2632
+ Array [
2633
+ 7,
2634
+ Object {
2635
+ "context": null,
2636
+ "didHooksChange": false,
2637
+ "props": Array [],
2638
+ "state": null,
2639
+ },
2640
+ ],
2641
+ Array [
2642
+ 6,
2643
+ Object {
2644
+ "context": Array [],
2645
+ "didHooksChange": false,
2646
+ "props": Array [],
2647
+ "state": null,
2648
+ },
2649
+ ],
2650
+ Array [
2651
+ 2,
2652
+ Object {
2653
+ "context": null,
2654
+ "didHooksChange": false,
2655
+ "props": Array [
2656
+ "bar",
2657
+ ],
2658
+ "state": Array [],
2659
+ },
2660
+ ],
2661
+ ],
2662
+ "duration": 0,
2663
+ "fiberActualDurations": Array [
2664
+ Array [
2665
+ 5,
2666
+ 0,
2667
+ ],
2668
+ Array [
2669
+ 4,
2670
+ 0,
2671
+ ],
2672
+ Array [
2673
+ 7,
2674
+ 0,
2675
+ ],
2676
+ Array [
2677
+ 6,
2678
+ 0,
2679
+ ],
2680
+ Array [
2681
+ 3,
2682
+ 0,
2683
+ ],
2684
+ Array [
2685
+ 2,
2686
+ 0,
2687
+ ],
2688
+ Array [
2689
+ 1,
2690
+ 0,
2691
+ ],
2692
+ ],
2693
+ "fiberSelfDurations": Array [
2694
+ Array [
2695
+ 5,
2696
+ 0,
2697
+ ],
2698
+ Array [
2699
+ 4,
2700
+ 0,
2701
+ ],
2702
+ Array [
2703
+ 7,
2704
+ 0,
2705
+ ],
2706
+ Array [
2707
+ 6,
2708
+ 0,
2709
+ ],
2710
+ Array [
2711
+ 3,
2712
+ 0,
2713
+ ],
2714
+ Array [
2715
+ 2,
2716
+ 0,
2717
+ ],
2718
+ Array [
2719
+ 1,
2720
+ 0,
2721
+ ],
2722
+ ],
2723
+ "interactionIDs": Array [],
2724
+ "priorityLevel": "Immediate",
2725
+ "screenshot": null,
2726
+ "timestamp": 0,
2727
+ },
2728
+ ],
2729
+ "displayName": "LegacyContextProvider",
2730
+ "initialTreeBaseDurations": Array [],
2731
+ "interactionCommits": Array [],
2732
+ "interactions": Array [],
2733
+ "operations": Array [
2734
+ Array [
2735
+ 1,
2736
+ 1,
2737
+ 110,
2738
+ 21,
2739
+ 76,
2740
+ 101,
2741
+ 103,
2742
+ 97,
2743
+ 99,
2744
+ 121,
2745
+ 67,
2746
+ 111,
2747
+ 110,
2748
+ 116,
2749
+ 101,
2750
+ 120,
2751
+ 116,
2752
+ 80,
2753
+ 114,
2754
+ 111,
2755
+ 118,
2756
+ 105,
2757
+ 100,
2758
+ 101,
2759
+ 114,
2760
+ 16,
2761
+ 67,
2762
+ 111,
2763
+ 110,
2764
+ 116,
2765
+ 101,
2766
+ 120,
2767
+ 116,
2768
+ 46,
2769
+ 80,
2770
+ 114,
2771
+ 111,
2772
+ 118,
2773
+ 105,
2774
+ 100,
2775
+ 101,
2776
+ 114,
2777
+ 21,
2778
+ 77,
2779
+ 111,
2780
+ 100,
2781
+ 101,
2782
+ 114,
2783
+ 110,
2784
+ 67,
2785
+ 111,
2786
+ 110,
2787
+ 116,
2788
+ 101,
2789
+ 120,
2790
+ 116,
2791
+ 67,
2792
+ 111,
2793
+ 110,
2794
+ 115,
2795
+ 117,
2796
+ 109,
2797
+ 101,
2798
+ 114,
2799
+ 26,
2800
+ 70,
2801
+ 117,
2802
+ 110,
2803
+ 99,
2804
+ 116,
2805
+ 105,
2806
+ 111,
2807
+ 110,
2808
+ 67,
2809
+ 111,
2810
+ 109,
2811
+ 112,
2812
+ 111,
2813
+ 110,
2814
+ 101,
2815
+ 110,
2816
+ 116,
2817
+ 87,
2818
+ 105,
2819
+ 116,
2820
+ 104,
2821
+ 72,
2822
+ 111,
2823
+ 111,
2824
+ 107,
2825
+ 115,
2826
+ 21,
2827
+ 76,
2828
+ 101,
2829
+ 103,
2830
+ 97,
2831
+ 99,
2832
+ 121,
2833
+ 67,
2834
+ 111,
2835
+ 110,
2836
+ 116,
2837
+ 101,
2838
+ 120,
2839
+ 116,
2840
+ 67,
2841
+ 111,
2842
+ 110,
2843
+ 115,
2844
+ 117,
2845
+ 109,
2846
+ 101,
2847
+ 114,
2848
+ 1,
2849
+ 1,
2850
+ 11,
2851
+ 1,
2852
+ 1,
2853
+ 1,
2854
+ 2,
2855
+ 1,
2856
+ 1,
2857
+ 0,
2858
+ 1,
2859
+ 0,
2860
+ 4,
2861
+ 2,
2862
+ 0,
2863
+ 1,
2864
+ 3,
2865
+ 2,
2866
+ 2,
2867
+ 2,
2868
+ 2,
2869
+ 0,
2870
+ 4,
2871
+ 3,
2872
+ 0,
2873
+ 1,
2874
+ 4,
2875
+ 1,
2876
+ 3,
2877
+ 2,
2878
+ 3,
2879
+ 0,
2880
+ 4,
2881
+ 4,
2882
+ 0,
2883
+ 1,
2884
+ 5,
2885
+ 5,
2886
+ 4,
2887
+ 4,
2888
+ 4,
2889
+ 0,
2890
+ 4,
2891
+ 5,
2892
+ 0,
2893
+ 1,
2894
+ 6,
2895
+ 1,
2896
+ 3,
2897
+ 2,
2898
+ 5,
2899
+ 0,
2900
+ 4,
2901
+ 6,
2902
+ 0,
2903
+ 1,
2904
+ 7,
2905
+ 5,
2906
+ 6,
2907
+ 6,
2908
+ 4,
2909
+ 0,
2910
+ 4,
2911
+ 7,
2912
+ 0,
2913
+ ],
2914
+ Array [
2915
+ 1,
2916
+ 1,
2917
+ 0,
2918
+ ],
2919
+ Array [
2920
+ 1,
2921
+ 1,
2922
+ 0,
2923
+ ],
2924
+ Array [
2925
+ 1,
2926
+ 1,
2927
+ 0,
2928
+ ],
2929
+ Array [
2930
+ 1,
2931
+ 1,
2932
+ 0,
2933
+ ],
2934
+ ],
2935
+ "rootID": 1,
2936
+ "snapshots": Array [],
2937
+ },
2938
+ ],
2939
+ "version": 4,
2940
+}
2941
+`;
2942
+
2943
exports[`ProfilingCache should record when props/state/hooks change: CommitDetails commitIndex: 0 1`] = `
2944
Object {
2945
"changeDescriptions": Map {},
src/__tests__/profilingCache-test.js
+11
-4
@@ -190,7 +190,7 @@ describe('ProfilingCache', () => {
190
}
191
});
192
193
- it('should record when props/state/hooks change', () => {
193
+ it('should record changed props/state/context/hooks', () => {
194
let instance = null;
195
196
const ModernContext = React.createContext(0);
@@ -246,6 +246,13 @@ describe('ProfilingCache', () => {
246
utils.act(() => ReactDOM.render(<LegacyContextProvider />, container));
247
expect(instance).not.toBeNull();
248
utils.act(() => (instance: any).setState({ count: 1 }));
249
+ utils.act(() =>
250
+ ReactDOM.render(<LegacyContextProvider foo={123} />, container)
251
+ );
252
+ utils.act(() =>
253
+ ReactDOM.render(<LegacyContextProvider bar="abc" />, container)
254
+ );
255
+ utils.act(() => ReactDOM.render(<LegacyContextProvider />, container));
256
utils.act(() => store.profilerStore.stopProfiling());
257
258
const allCommitData = [];
@@ -265,7 +272,7 @@ describe('ProfilingCache', () => {
272
273
const rootID = store.roots[0];
274
268
- for (let commitIndex = 0; commitIndex < 2; commitIndex++) {
275
+ for (let commitIndex = 0; commitIndex < 5; commitIndex++) {
276
utils.act(() => {
277
TestRenderer.create(
278
<Validator
@@ -277,11 +284,11 @@ describe('ProfilingCache', () => {
284
});
285
}
286
280
- expect(allCommitData).toHaveLength(2);
287
+ expect(allCommitData).toHaveLength(5);
288
289
utils.exportImportHelper(bridge, store);
290
284
- for (let commitIndex = 0; commitIndex < 2; commitIndex++) {
291
+ for (let commitIndex = 0; commitIndex < 5; commitIndex++) {
292
utils.act(() => {
293
TestRenderer.create(
294
<Validator