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 @@ -7,12 +7,11 @@
* @flow
*/

import {normalizeCodeLocInfo} from './utils';
import {getVersionedRenderImplementation, normalizeCodeLocInfo} from './utils';

describe('component stack', () => {
let React;
let act;
let legacyRender;
let mockError;
let mockWarn;

Expand All @@ -30,11 +29,12 @@ describe('component stack', () => {

const utils = require('./utils');
act = utils.act;
legacyRender = utils.legacyRender;

React = require('react');
});

const {render} = getVersionedRenderImplementation();

// @reactVersion >=16.9
it('should log the current component stack along with an error or warning', () => {
const Grandparent = () => <Parent />;
Expand All @@ -45,9 +45,7 @@ describe('component stack', () => {
return null;
};

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

act(() => legacyRender(<Grandparent />, container));
act(() => render(<Grandparent />));

expect(mockError).toHaveBeenCalledWith(
'Test error.',
Expand Down Expand Up @@ -79,8 +77,7 @@ describe('component stack', () => {
return null;
};

const container = document.createElement('div');
act(() => legacyRender(<Example test="abc" />, container));
act(() => render(<Example test="abc" />));

expect(useEffectCount).toBe(1);

Expand Down