My name is Kent C. Dodds and I'm a Remix Co-Founder, JavaScript engineer, and teacher. I'm also active in the open source community. I like my family, JavaScript, and React.
I should write about this. People who complain that tests break a lot when testing this way don't understand that they're breaking for the right reasons whereas testing implemention details makes your tests break for the wrong reasons. Ugh.
:/ Ever since I learned about the RTL ideology, using Enzyme has just been pretty miserable for me. It's so ez to test an implementation detail, find elements that also return the Component element rather than just the DOM element.
At work, I mostly see shallow rendering, expecting this shallow wrapper to match snapshot, expecting wrapper.state('whatever') to equal something... Don't really wanna start any crap so I try not to say anything.
Also, I can't seem to find another reliable way in Enzyme to wait for an async componentDidMount besides returning the promise inside componentDidMount and awaiting. I don't really like this approach though... because it relies on implementation detail.
My name is Kent C. Dodds and I'm a Remix Co-Founder, JavaScript engineer, and teacher. I'm also active in the open source community. I like my family, JavaScript, and React.
I should write about this. People who complain that tests break a lot when testing this way don't understand that they're breaking for the right reasons whereas testing implemention details makes your tests break for the wrong reasons. Ugh.
:/ Ever since I learned about the RTL ideology, using Enzyme has just been pretty miserable for me. It's so ez to test an implementation detail, find elements that also return the Component element rather than just the DOM element.
At work, I mostly see shallow rendering, expecting this shallow wrapper to match snapshot, expecting
wrapper.state('whatever')
to equal something... Don't really wanna start any crap so I try not to say anything.Also, I can't seem to find another reliable way in Enzyme to wait for an async
componentDidMount
besides returning the promise insidecomponentDidMount
and awaiting. I don't really like this approach though... because it relies on implementation detail.The frontend architect at my company endorses this pattern. So I'm pretty much forced to use this pattern since I can't use RTL
waitForElement
.Btw, looking forward to your talk at useReactNYC on Tuesday.
Sweet! Let me know who you are! Looking forward to meeting you.