Fix devtools tests after internal test changes (#26405)

This commit is contained in:
Ricky
2023-03-16 08:14:23 -04:00
committed by GitHub
parent 27d0fa4890
commit 2db5ef526c
3 changed files with 18 additions and 13 deletions
@@ -1324,7 +1324,7 @@ describe('Timeline profiler', () => {
expect(timelineData.batchUIDToMeasuresMap.size).toBe(2);
});
// @reactVersion >=18.0
// @reactVersion >=18.2
it('should mark render yields', async () => {
function Bar() {
Scheduler.log('Bar');
@@ -1409,7 +1409,7 @@ describe('Timeline profiler', () => {
expect(timelineData.componentMeasures).toHaveLength(2);
});
// @reactVersion >=18.0
// @reactVersion >=18.2
it('should mark sync render with suspense that rejects', async () => {
let rejectFn;
let rejected = false;
@@ -1467,7 +1467,7 @@ describe('Timeline profiler', () => {
expect(timelineData.componentMeasures).toHaveLength(2);
});
// @reactVersion >=18.0
// @reactVersion >=18.2
it('should mark concurrent render with suspense that resolves', async () => {
let resolveFn;
let resolved = false;
@@ -1525,7 +1525,7 @@ describe('Timeline profiler', () => {
expect(timelineData.componentMeasures).toHaveLength(2);
});
// @reactVersion >=18.0
// @reactVersion >=18.2
it('should mark concurrent render with suspense that rejects', async () => {
let rejectFn;
let rejected = false;
@@ -1349,7 +1349,7 @@ describe('Timeline profiler', () => {
);
});
// @reactVersion >= 18.0
// @reactVersion >= 18.2
it('should not warn when React finishes a previously long (async) update with a short (sync) update inside of an event', async () => {
function Yield({id, value}) {
Scheduler.log(`${id}:${value}`);
@@ -1411,7 +1411,7 @@ describe('Timeline profiler', () => {
});
describe('nested updates', () => {
// @reactVersion >= 18.0
// @reactVersion >= 18.2
it('should not warn about short nested (state) updates during layout effects', async () => {
function Component() {
const [didMount, setDidMount] = React.useState(false);
@@ -1442,7 +1442,7 @@ describe('Timeline profiler', () => {
expect(event.warning).toBe(null);
});
// @reactVersion >= 18.0
// @reactVersion >= 18.2
it('should not warn about short (forced) updates during layout effects', async () => {
class Component extends React.Component {
_didMount: boolean = false;
@@ -1595,7 +1595,7 @@ describe('Timeline profiler', () => {
);
});
// @reactVersion >= 18.0
// @reactVersion >= 18.2
it('should not warn about transition updates scheduled during commit phase', async () => {
function Component() {
const [value, setValue] = React.useState(0);
@@ -1781,10 +1781,10 @@ describe('Timeline profiler', () => {
});
describe('suspend during an update', () => {
// This also tests an edge case where the a component suspends while profiling
// This also tests an edge case where a component suspends while profiling
// before the first commit is logged (so the lane-to-labels map will not yet exist).
// @reactVersion >= 18.0
it('should warn about suspending during an udpate', async () => {
// @reactVersion >= 18.2
it('should warn about suspending during an update', async () => {
let promise = null;
let resolvedValue = null;
function readValue(value) {
@@ -1841,7 +1841,7 @@ describe('Timeline profiler', () => {
);
});
// @reactVersion >= 18.0
// @reactVersion >= 18.2
it('should not warn about suspending during an transition', async () => {
let promise = null;
let resolvedValue = null;
@@ -19,7 +19,12 @@ describe('Store component filters', () => {
let utils;
const act = async (callback: Function) => {
await React.unstable_act(callback);
if (React.unstable_act != null) {
await React.unstable_act(callback);
} else {
callback();
}
jest.runAllTimers(); // Flush Bridge operations
};