Andrey (azangru) wrote,

Couple of things that mystify me in the debate of enzyme vs react-testing-library.

1) Insistence that Enzyme does only shallow rendering of a component:

> In short, where Enzyme only “shallow” renders a component, react-testing-library actually renders the component that you are testing.

This is pure nonsense: user of Enzyme has liberty to choose between shallow rendering, full DOM rendering or static rendering for a particular test.

2) Complaints that Enzyme does not support React hooks:

> The error above means that Hooks are not yet supported in Enzyme as seen in this issue here.

Again, what is not supported is shallow rendering with hooks. Other types of rendering work fine (as can be seen in the sample codesandbox when shallow renderer is changed to a different one).

3) Suggestion in react-testing-library docs that finding DOM elements by CSS selectors for making assertions is a bad practice, because:

> users can't see or identify these attributes.

Why should a test depend on visual powers of the users (when even end-to-end tests with Selenium, headless Chrome, etc. happily rely on unique CSS selectors) is quite beyond me.

  • (no subject)

    com-petere со-ревновать-ся

  • (no subject)

    Someone is actually running a youtube ad campaign targeting React developers with a course on becoming a UI architect: The site that the ad…

  • (no subject)

    A beautiful cartoon on the front page of The Week:

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.