Andrey (azangru) wrote,
Andrey
azangru

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.
(link)

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.
(link)

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.
(link)

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.
Subscribe

  • Via Twitter

    Via a tweet, but I thought I'd get my own copy. A beautiful illustration of how a caption totally misrepresents what's been captured in the photo.…

  • (no subject)

    Here's an extract from Uncle Bob's book Clean Agile. Although he has fallen out of grace with the champions of social justice, the sentiment…

  • (no subject)

    Twelve thousand people pressed the button. Obviously most of them his followers, but still... interesting:

  • Post a new comment

    Error

    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.
  • 0 comments