3 ms·
One of the big advantages of React is that it's straightforward to unit test your components. Plus there's Jest, which makes a lot of the hard bits of testing m
by onion2k 10y ago
One of the big advantages of React is that it's straightforward to unit test your components. Plus there's Jest, which makes a lot of the hard bits of testing much easier.
(I say this as a developer who mostly uses Angular and Vue rather than React. I wish I had the React toolchain in other frameworks.)
- pmarreck 10y agoHow would I run a React unit test from the command line? Or would I have to run it in-browser? Any pointers would be welcome
- onion2k 10y agoJest uses jsdom. You just need to add it to a project ("npm install --save-dev jest"), write a spec, and then run npm test (maybe update package.json to have 'jest' as the test command). It's really, really easy. There's even a repl so you can try it in a browser first - https://facebook.github.io/jest/#use https://facebook.github.io/jest/#use