Jest Throws A Warning - ValidateDOMNesting(...): Cannot Appear ...

Skip to content Dismiss alert {{ message }} / react-testing-library Public
  • Notifications You must be signed in to change notification settings
  • Fork 1.2k
  • Star 19.5k
  • Code
  • Issues 62
  • Pull requests 13
  • Actions
  • Security

    Uh oh!

    There was an error while loading. Please reload this page.

  • Insights
Additional navigation options Jest throws a warning - validateDOMNesting(...): <td> cannot appear as a child of <div>. #515New issueNew issueClosedClosedJest throws a warning - validateDOMNesting(...): <td> cannot appear as a child of <div>.#515@karthikvt26

Description

@karthikvt26karthikvt26opened on Oct 30, 2019
  • react-testing-library version: 9.3.0
  • react version: 16.9.0
  • node version: 10.16.3
  • npm (or yarn) version: 6.9.0 (npm)

Relevant code or config:

App is created using create-react-app, assuming it is using a default jest configuration

What you did:

const { container } = render( <td>Hello World</td> ); expect(container).toBeTruthy();

What happened:

The above works but jest throws a warning because render seems to render the stuff inside a <div> -- in this case td ... inside a div.

DeepinScreenshot_select-area_20191030155826

Reproduction:

Problem description:

I am not sure if this is a problem. But looking forward to understand the behaviour and if it is intended and if yes would love to know the reason :)

Suggested solution:

👍React with 👍3

Metadata

Metadata

Assignees

No one assigned

Labels

No labelsNo labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You can’t perform that action at this time.

Từ khóa » Html Cannot Appear As A Child Of Div