Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

import type Store from 'react-devtools-shared/src/devtools/store';

import {getVersionedRenderImplementation} from './utils';

describe('profiling charts', () => {
let React;
let Scheduler;
let legacyRender;
let store: Store;
let utils;

beforeEach(() => {
utils = require('./utils');
utils.beforeEachProfiling();

legacyRender = utils.legacyRender;

store = global.store;
store.collapseNodesByDefault = false;
store.recordChangeDescriptions = true;
Expand All @@ -30,6 +29,8 @@ describe('profiling charts', () => {
Scheduler = require('scheduler');
});

const {render} = getVersionedRenderImplementation();

function getFlamegraphChartData(rootID, commitIndex) {
const commitTree = store.profilerStore.profilingCache.getCommitTree({
commitIndex,
Expand Down Expand Up @@ -78,11 +79,9 @@ describe('profiling charts', () => {
return null;
});

const container = document.createElement('div');

utils.act(() => store.profilerStore.startProfiling());

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand All @@ -91,7 +90,7 @@ describe('profiling charts', () => {
<Child key="third"> [Memo]
`);

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand Down Expand Up @@ -228,11 +227,9 @@ describe('profiling charts', () => {
return null;
});

const container = document.createElement('div');

utils.act(() => store.profilerStore.startProfiling());

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand All @@ -241,7 +238,7 @@ describe('profiling charts', () => {
<Child key="third"> [Memo]
`);

utils.act(() => legacyRender(<Parent />, container));
utils.act(() => render(<Parent />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Parent>
Expand Down