- I only noticed that I had this copy and pasted for one section of my unit tests when I made an error and realized the test didnât fail.Which leads me toâŚMake sure your testsÂ failIf youâre awesome and use TDD, then props to you youâre already doing this đFor the rest…
- Time to move on.âHowever this leads to errors like the aforementioned one, and itâs surprisingly easy to grab and test the wrong element or mocked functionâââespecially if youâre copy pasting from a similar test.Itâs not hard to just comment out an essential section of a test and make sure it…
- Itâs also easy to copy to another component with a similar need for testing.In fact all of the little conventions Iâm following here (beforeEach mounting a wrapper, what I name things, spreading a props object) are great to have defined somewhere so people can easily understand and copy test functionality…
- It also makes testing quite simple and separates rendering vs data concernsI try to extract any complex data manipulation to pure functions and test thoseI use end to end (Selenium) and integration tests to check on sections of my app to make sure it all fits together.Itâs not perfect, Iâm…
If you don’t work at a primarily tech company, it can be a bit difficult to convince managers of the importance of things like unit testing. After being a enthusiastic supporter for quite a while, I…
Continue reading “Lessons learned testing React & Redux apps with Jest and Enzyme”
- It can now switch between running all tests or only test files related to changed files by pressing a or o .
- Jest now uses verbose mode when only a single test file is executed.
- By pressing p a prompt appears that allows to specify a test pattern to focus on a specific set of files.
- Jest used to implicitly reset all modules before each test and we recommended requiring modules in beforeEach or inside of tests.
- When running multiple tests in parallel, it was often hard to find out which test and which module was calling a log function.
We spent the past year making Jest faster, easier to configure, added tons of features and built snapshot testing. However, there were two areas where we invested very little: the CLI output and user experience. With Jest 15 we are changing the framework radically to make it easier to use both for beginners and experienced users. We are excited that our investment in Jest is now paying off: we can move fast and improve the framework for Facebook and the open source community at light-speed. Jest’s goal is to come with batteries included and to require as little configuration as necessary. We recently got a chance to explain our philosophy on a create-react-app issue.
Continue reading “Jest 15.0: New Defaults for Jest · Jest”
- ./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
- ./src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js: `Apple` was skipped because of inconvertible mixins.
- ./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Switcher` was skipped because of inconvertible mixins.
- ./src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js: `Anon` was skipped because of invalid field(s) `render` on the React component.
- ./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Row` was skipped because of invalid field(s) `render` on the React component.
Read the full article, click here.
@keyanzhang: “We just used the new codemod to codemod @reactjs itself and it was fun:”
Codemod tests from createClass to ES2015 classes by keyanzhang · Pull Request #7321 · facebook/react · GitHub