Fix devtools tests after internal test changes (#26405)
Ricky committed
Mar 16, 2023 at 08:14 UTC
9941cbacacb81c27a088b0bc2781b990bcbae1cd
3 files changed
+18
-13
packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js
+4
-4
@@ -1324,7 +1324,7 @@ describe('Timeline profiler', () => {
1324
expect(timelineData.batchUIDToMeasuresMap.size).toBe(2);
1325
});
1326
1327
- // @reactVersion >=18.0
1327
+ // @reactVersion >=18.2
1328
it('should mark render yields', async () => {
1329
function Bar() {
1330
Scheduler.log('Bar');
@@ -1409,7 +1409,7 @@ describe('Timeline profiler', () => {
1409
expect(timelineData.componentMeasures).toHaveLength(2);
1410
});
1411
1412
- // @reactVersion >=18.0
1412
+ // @reactVersion >=18.2
1413
it('should mark sync render with suspense that rejects', async () => {
1414
let rejectFn;
1415
let rejected = false;
@@ -1467,7 +1467,7 @@ describe('Timeline profiler', () => {
1467
expect(timelineData.componentMeasures).toHaveLength(2);
1468
});
1469
1470
- // @reactVersion >=18.0
1470
+ // @reactVersion >=18.2
1471
it('should mark concurrent render with suspense that resolves', async () => {
1472
let resolveFn;
1473
let resolved = false;
@@ -1525,7 +1525,7 @@ describe('Timeline profiler', () => {
1525
expect(timelineData.componentMeasures).toHaveLength(2);
1526
});
1527
1528
- // @reactVersion >=18.0
1528
+ // @reactVersion >=18.2
1529
it('should mark concurrent render with suspense that rejects', async () => {
1530
let rejectFn;
1531
let rejected = false;
packages/react-devtools-shared/src/__tests__/preprocessData-test.js
+8
-8
@@ -1349,7 +1349,7 @@ describe('Timeline profiler', () => {
1349
);
1350
});
1351
1352
- // @reactVersion >= 18.0
1352
+ // @reactVersion >= 18.2
1353
it('should not warn when React finishes a previously long (async) update with a short (sync) update inside of an event', async () => {
1354
function Yield({id, value}) {
1355
Scheduler.log(`${id}:${value}`);
@@ -1411,7 +1411,7 @@ describe('Timeline profiler', () => {
1411
});
1412
1413
describe('nested updates', () => {
1414
- // @reactVersion >= 18.0
1414
+ // @reactVersion >= 18.2
1415
it('should not warn about short nested (state) updates during layout effects', async () => {
1416
function Component() {
1417
const [didMount, setDidMount] = React.useState(false);
@@ -1442,7 +1442,7 @@ describe('Timeline profiler', () => {
1442
expect(event.warning).toBe(null);
1443
});
1444
1445
- // @reactVersion >= 18.0
1445
+ // @reactVersion >= 18.2
1446
it('should not warn about short (forced) updates during layout effects', async () => {
1447
class Component extends React.Component {
1448
_didMount: boolean = false;
@@ -1595,7 +1595,7 @@ describe('Timeline profiler', () => {
1595
);
1596
});
1597
1598
- // @reactVersion >= 18.0
1598
+ // @reactVersion >= 18.2
1599
it('should not warn about transition updates scheduled during commit phase', async () => {
1600
function Component() {
1601
const [value, setValue] = React.useState(0);
@@ -1781,10 +1781,10 @@ describe('Timeline profiler', () => {
1781
});
1782
1783
describe('suspend during an update', () => {
1784
- // This also tests an edge case where the a component suspends while profiling
1784
+ // This also tests an edge case where a component suspends while profiling
1785
// before the first commit is logged (so the lane-to-labels map will not yet exist).
1786
- // @reactVersion >= 18.0
1787
- it('should warn about suspending during an udpate', async () => {
1786
+ // @reactVersion >= 18.2
1787
+ it('should warn about suspending during an update', async () => {
1788
let promise = null;
1789
let resolvedValue = null;
1790
function readValue(value) {
@@ -1841,7 +1841,7 @@ describe('Timeline profiler', () => {
1841
);
1842
});
1843
1844
- // @reactVersion >= 18.0
1844
+ // @reactVersion >= 18.2
1845
it('should not warn about suspending during an transition', async () => {
1846
let promise = null;
1847
let resolvedValue = null;
packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js
+6
-1
@@ -19,7 +19,12 @@ describe('Store component filters', () => {
19
let utils;
20
21
const act = async (callback: Function) => {
22
- await React.unstable_act(callback);
22
+ if (React.unstable_act != null) {
23
+ await React.unstable_act(callback);
24
+ } else {
25
+ callback();
26
+ }
27
+
28
jest.runAllTimers(); // Flush Bridge operations
29
};
30