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

  • (no subject)

    (retweeted by a developer) How does she interpret what she has highlighted — "unlawful blocking of a public street" — as "pedestrians whose…

  • (no subject)

    Google has finally become ready to promote its Lit ecosystem properly. I thought they were going make their announcements at the coming Google IO;…

  • (no subject)

    Is it ... Bill Maher? Is he, in the penetrating eyes of this insightful lady, the emblem of white supremacy now? The comments to the tweet say it…

  • 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