jest

  • A Jest test that mocked the module under test

    A test file that mocked the module it imported, so it asserted the behaviour of the mock and passed after the implementation was deleted. It had been added…

  • A test that renders once because StrictMode is off

    A component test passing in the suite and the same component double-fetching in development, because the test environment did not have the double invocation. The test environment and…

  • React 17 is a release with no features

    A major version whose entire purpose is to let two versions run on one page. And an event delegation change that breaks anything mixing React with jQuery.

  • Testing through the DOM rather than the component instance

    A test that reaches into component state asserts on the implementation, and every refactor that changed nothing observable breaks it. Querying by role rather than by test id…

  • Vue 3 and the Composition API

    A 600-line component with a mixin nobody could trace. The Composition API is not a new way to write components — it is a way to move logic…

  • TypeScript on a JavaScript codebase, one file at a time

    3.7 shipped optional chaining in November and the objection got smaller. allowJs, checkJs and a per-file opt-in — and strictNullChecks, which is the flag that pays.

  • Testing a hook with renderHook and nothing else

    A hook cannot be called outside a component, so testing one used to mean building a throwaway component and asserting on what it rendered — which tests the…

  • Testing a hook without rendering a component

    A hook cannot be called outside a component, so testing one used to mean building a throwaway component and asserting on what it rendered. act is what flushes…

  • Jest snapshots age badly unless the diff is read

    A failing snapshot is regenerated with -u, and after the third time that becomes reflex — at which point the test asserts that the output equals whatever the…

  • Hooks arrived and the class component did not have to go

    16.8 shipped on 6 February and the migration pressure was immediate and mostly self-inflicted. What they actually solve, and what the dependency array means.