DEV Community


Discussion on: Why testing-library fails to do what it set out to do

revelt profile image
Roy Revelt

To sum up, serious projects need unit testing (React Testing Library, Jest — TDD) but also end-to-end testing (Cypress/WebdriverIO — BDD). That's just two different testing angles. Running Cypress on a component, to test prop is overkill. That's what RTL is for. On the same way, user interactions like you described with user typing is typical Cypress area. Using RTL for that is cumbersome if not impossible like you noted.

PS. let's fix typo "rent over" to "rant over"

rangeoshun profile image
Abel Varga Author

Thanks for noting the typo, fixed it.

On the matter of RTL, I'm not sure if it's unavoidable. If you maintain a Storybook, you could do a lot of your unit tests there, with puppeteer, you need to assert your expectations in your E2E framework.

There are cases where I cannot imagine using a browser with current tooling but could imagine tooling that would allow. Like mocking global variables like location and etc.

So in short TDD does not say anything about the environment you run it in IMHO.