visx
visx copied to clipboard
Testing approaches in this project
@williaster @hshoff I have a few questions about testing approaches in this project. I understand Airbnb probably has its coding tools standards but I was wondering how strict they are ? :) For example, would it be possible to migrate from enzyme to a much better Testing Library. I also noticed use of shallow rendering in tests which is not the best approach. There is also cypress-react-unit-test which for projects like visx could be a nice option to consider as well, maybe not for all but some of the interactive tests because it renders in real browser. Could you share your thoughts ?
Hey @m0t0r thanks for creating this issue ๐ (and sorry about the complexities of this as it relates to the react@17 upgrade in #872, yak shaving for sure)
Generally Airbnb is moving toward using react-testing-library (which you've linked to), so I think we are supportive of moving in that direction for visx over enzyme. Currently I'm not sure we have the bandwidth to do this migration ourselves, so I'll tag this issue with ๐ help wanted. If you or others are interested in helping with this we would happily review any PRs ๐ .
As far as cypress / visual testing, we are planning to add screenshot testing with happo ๐ฆ soon (my plan is before end of 2020) for the demo package so that we can better-detect visual changes.
Not sure if @hshoff has any other thoughts to add.
Hi @williaster, great, thanks for your reply, I appreciate. Yes, migrating to react-testing-library may take quite a bit of efforts. I will try to start looking into that and maybe get an initial plan.
My preference would be to wait for the official enzyme 17 adapter. Migrating the entire test suite to react-testing-library should be a separate discussion vs supporting react 17 as a peerDep.
@hshoff are you also planning to use jest for testing?
We currently use jest for unit tests and I think this would be true even if we moved to react-testing-library since jest provides the runner + the assertion framework, not the react manipulations.
Also an update, we now use happo for visual testing of all gallery examples as added in #1030