Skip to content

Commit 8134676

Browse files
authored
Run persistent tests in more configurations in CI (#21880)
I noticed that `enableSuspenseLayoutEffectSemantics` is not fully implemented in persistent mode. I believe this was an oversight because we don't have a CI job that runs tests in persistent mode and with experimental flags enabled. This adds additional test configurations to the CI job so we don't miss stuff like this again. It doesn't fix the failing tests — I'll address that separately.
1 parent 9090257 commit 8134676

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ workflows:
456456

457457
# TODO: Test more persistent configurations?
458458
- '-r=stable --env=development --persistent'
459+
- '-r=experimental --env=development --persistent'
459460
- yarn_build_combined:
460461
requires:
461462
- setup

packages/react-reconciler/src/__tests__/ReactOffscreen-test.js

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ describe('ReactOffscreen', () => {
220220

221221
// @gate experimental || www
222222
// @gate enableSuspenseLayoutEffectSemantics
223+
// @gate !persistent
223224
it('mounts/unmounts layout effects when visibility changes (starting visible)', async () => {
224225
function Child({text}) {
225226
useLayoutEffect(() => {
@@ -270,6 +271,7 @@ describe('ReactOffscreen', () => {
270271

271272
// @gate experimental || www
272273
// @gate enableSuspenseLayoutEffectSemantics
274+
// @gate !persistent
273275
it('mounts/unmounts layout effects when visibility changes (starting hidden)', async () => {
274276
function Child({text}) {
275277
useLayoutEffect(() => {

packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js

+22
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ let caches;
1717
let seededCache;
1818
let ErrorBoundary;
1919

20+
// TODO: These tests don't pass in persistent mode yet. Need to implement.
21+
2022
describe('ReactSuspenseEffectsSemantics', () => {
2123
beforeEach(() => {
2224
jest.resetModules();
@@ -565,6 +567,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
565567

566568
// @gate enableSuspenseLayoutEffectSemantics
567569
// @gate enableCache
570+
// @gate !persistent
568571
it('should be destroyed and recreated for function components', async () => {
569572
function App({children = null}) {
570573
Scheduler.unstable_yieldValue('App render');
@@ -694,6 +697,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
694697

695698
// @gate enableSuspenseLayoutEffectSemantics
696699
// @gate enableCache
700+
// @gate !persistent
697701
it('should be destroyed and recreated for class components', async () => {
698702
class ClassText extends React.Component {
699703
componentDidMount() {
@@ -839,6 +843,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
839843

840844
// @gate enableSuspenseLayoutEffectSemantics
841845
// @gate enableCache
846+
// @gate !persistent
842847
it('should be destroyed and recreated when nested below host components', async () => {
843848
function App({children = null}) {
844849
Scheduler.unstable_yieldValue('App render');
@@ -949,6 +954,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
949954

950955
// @gate enableSuspenseLayoutEffectSemantics
951956
// @gate enableCache
957+
// @gate !persistent
952958
it('should be destroyed and recreated even if there is a bailout because of memoization', async () => {
953959
const MemoizedText = React.memo(Text, () => true);
954960

@@ -1065,6 +1071,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
10651071

10661072
// @gate enableSuspenseLayoutEffectSemantics
10671073
// @gate enableCache
1074+
// @gate !persistent
10681075
it('should respect nested suspense boundaries', async () => {
10691076
function App({innerChildren = null, outerChildren = null}) {
10701077
return (
@@ -1288,6 +1295,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
12881295

12891296
// @gate enableSuspenseLayoutEffectSemantics
12901297
// @gate enableCache
1298+
// @gate !persistent
12911299
it('should show nested host nodes if multiple boundaries resolve at the same time', async () => {
12921300
function App({innerChildren = null, outerChildren = null}) {
12931301
return (
@@ -1398,6 +1406,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
13981406

13991407
// @gate enableSuspenseLayoutEffectSemantics
14001408
// @gate enableCache
1409+
// @gate !persistent
14011410
it('should be cleaned up inside of a fallback that suspends', async () => {
14021411
function App({fallbackChildren = null, outerChildren = null}) {
14031412
return (
@@ -1541,6 +1550,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
15411550

15421551
// @gate enableSuspenseLayoutEffectSemantics
15431552
// @gate enableCache
1553+
// @gate !persistent
15441554
it('should be cleaned up inside of a fallback that suspends (alternate)', async () => {
15451555
function App({fallbackChildren = null, outerChildren = null}) {
15461556
return (
@@ -1661,6 +1671,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
16611671

16621672
// @gate enableSuspenseLayoutEffectSemantics
16631673
// @gate enableCache
1674+
// @gate !persistent
16641675
it('should be cleaned up deeper inside of a subtree that suspends', async () => {
16651676
function ConditionalSuspense({shouldSuspend}) {
16661677
if (shouldSuspend) {
@@ -1744,6 +1755,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
17441755
describe('that throw errors', () => {
17451756
// @gate enableSuspenseLayoutEffectSemantics
17461757
// @gate enableCache
1758+
// @gate !persistent
17471759
it('are properly handled for componentDidMount', async () => {
17481760
let componentDidMountShouldThrow = false;
17491761

@@ -1883,6 +1895,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
18831895

18841896
// @gate enableSuspenseLayoutEffectSemantics
18851897
// @gate enableCache
1898+
// @gate !persistent
18861899
it('are properly handled for componentWillUnmount', async () => {
18871900
class ThrowsInWillUnmount extends React.Component {
18881901
componentDidMount() {
@@ -1996,6 +2009,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
19962009

19972010
// @gate enableSuspenseLayoutEffectSemantics
19982011
// @gate enableCache
2012+
// @gate !persistent
19992013
// @gate replayFailedUnitOfWorkWithInvokeGuardedCallback
20002014
it('are properly handled for layout effect creation', async () => {
20012015
let useLayoutEffectShouldThrow = false;
@@ -2136,6 +2150,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
21362150

21372151
// @gate enableSuspenseLayoutEffectSemantics
21382152
// @gate enableCache
2153+
// @gate !persistent
21392154
// @gate replayFailedUnitOfWorkWithInvokeGuardedCallback
21402155
it('are properly handled for layout effect descruction', async () => {
21412156
function ThrowsInLayoutEffectDestroy() {
@@ -2248,6 +2263,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
22482263

22492264
// @gate enableSuspenseLayoutEffectSemantics
22502265
// @gate enableCache
2266+
// @gate !persistent
22512267
it('should be only destroy layout effects once if a tree suspends in multiple places', async () => {
22522268
class ClassText extends React.Component {
22532269
componentDidMount() {
@@ -2387,6 +2403,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
23872403

23882404
// @gate enableSuspenseLayoutEffectSemantics
23892405
// @gate enableCache
2406+
// @gate !persistent
23902407
it('should be only destroy layout effects once if a component suspends multiple times', async () => {
23912408
class ClassText extends React.Component {
23922409
componentDidMount() {
@@ -2671,6 +2688,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
26712688

26722689
// @gate enableSuspenseLayoutEffectSemantics
26732690
// @gate enableCache
2691+
// @gate !persistent
26742692
it('should be cleared and reset for host components', async () => {
26752693
function App({children}) {
26762694
Scheduler.unstable_yieldValue(`App render`);
@@ -2768,6 +2786,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
27682786

27692787
// @gate enableSuspenseLayoutEffectSemantics
27702788
// @gate enableCache
2789+
// @gate !persistent
27712790
it('should be cleared and reset for class components', async () => {
27722791
class ClassComponent extends React.Component {
27732792
render() {
@@ -2869,6 +2888,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
28692888

28702889
// @gate enableSuspenseLayoutEffectSemantics
28712890
// @gate enableCache
2891+
// @gate !persistent
28722892
it('should be cleared and reset for function components with useImperativeHandle', async () => {
28732893
const FunctionComponent = React.forwardRef((props, ref) => {
28742894
Scheduler.unstable_yieldValue('FunctionComponent render');
@@ -2974,6 +2994,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
29742994

29752995
// @gate enableSuspenseLayoutEffectSemantics
29762996
// @gate enableCache
2997+
// @gate !persistent
29772998
it('should not reset for user-managed values', async () => {
29782999
function RefChecker({forwardedRef}) {
29793000
Scheduler.unstable_yieldValue(`RefChecker render`);
@@ -3072,6 +3093,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
30723093
describe('that throw errors', () => {
30733094
// @gate enableSuspenseLayoutEffectSemantics
30743095
// @gate enableCache
3096+
// @gate !persistent
30753097
// @gate replayFailedUnitOfWorkWithInvokeGuardedCallback
30763098
it('are properly handled in ref callbacks', async () => {
30773099
let useRefCallbackShouldThrow = false;

scripts/jest/TestFlags.js

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const environmentFlags = {
4242
// Similarly, should stable imply "classic"?
4343
stable: !__EXPERIMENTAL__,
4444

45+
persistent: global.__PERSISTENT__ === true,
46+
4547
// Use this for tests that are known to be broken.
4648
FIXME: false,
4749

0 commit comments

Comments
 (0)