small medium large xlarge

Test-Driven React: Find Problems Early, Fix Them Quickly, Code with Confidence


Cover image for Test-Driven React

Test-Driven React

Find Problems Early, Fix Them Quickly, Code with Confidence


You work in a loop: write code, get feedback, iterate. The faster you get feedback, the faster you can learn and become a more effective developer. Test-Driven React helps you refine your React workflow to give you the feedback you need as quickly as possible. Write strong tests and run them continuously as you work, split complex code up into manageable pieces, and stay focused on what’s important by automating away mundane, trivial tasks. Adopt these techniques and you’ll be able to avoid productivity traps and start building React components at a stunning pace!

Choose Your Format(s)

  • $19.95 In Stock
    • Beta: What do I get?

  • Ebooks are DRM free.

  • Ebook delivery options.

  • The Paper Book will ship on 2019-07-10 (roughly).

About this Title

Pages: 170 (est)
Published: 2019-07-10
Release: B4.0 (2019-04-04)
ISBN: 978-1-68050-646-4

React has revolutionized web development by abstracting away the details of DOM manipulation. That conceptual elegance has opened the door to a new generation of web testing: clear, expressive, and lightning-fast. That makes React a perfect fit for test-driven development (TDD), a methodology in which tests are a blueprint instead of an afterthought.

Each chapter will present new projects to challenge you and new tools to help you. Write fast, portable tests with Jest. Keep your code tidy with ESLint and Prettier. Perform every task you need from a single window with VS Code. See your test output directly in your code with Wallaby. Use the JavaScript features of the future with Babel. Make assertions about React component behavior with Enzyme. And style components in a testable way with styled-components. By understanding every piece of your project’s stack, you’ll feel more confident and able to focus on what matters: writing reliable and maintainable code.

Discover a more joyful React development experience. Let your tests lead the way!

What You Need

You’ll need a working knowledge of JavaScript and a computer running macOS, Windows, or Linux.

Contents & Extracts

This book is currently in beta, so the contents and extracts will change as the book is developed.

  • Introduction
    • What’s In this Book
    • What’s Not In this Book
    • Online Resources
    • Mantra: Code with Joy
  • Test-Driven Development with Jest
    • Introducing Jest excerpt
    • The Tao of Test-Driven Development
    • Mantra: Red, Green, Repeat
    • Example Fizz Buzz solution
  • Integrated Tooling with VS Code
    • Editing with VS Code
    • Checking Code Quality with ESLint
    • Beautifying Code with Prettier
    • Real-Time Testing with Wallaby
    • Mantra: Live in the Code
    • Example Palindrome Finder Solution
  • Testing React with Enzyme excerpt
    • Starting a React Project
    • Testing Simple Components with Enzyme
    • Adding a Jest Setup File
    • Testing Nested Markup
    • Testing Stateful Components
    • Mantra: Test One Piece at a Time
  • Styling in JavaScript with Styled-Components excerpt
    • Packaging an App with Webpack
    • Getting Started with Styled-Components
    • Testing Styled Components
    • Mantra: Actively Seek Feedback
  • Refactoring with Higher-Order Components
    • The Controllable Pattern
    • Testing Timers
    • Inspecting Components with React Devtools
    • Mantra: Keep the Unit Small
  • Continuous Integration with TravisCI
    • Setting up TravisCI
    • Git Hooks with Husky
    • Adding Docs with Storybook
    • Mantra: Actively Automate


Trevor Burnham is an engineer at HubSpot in Cambridge, MA. His previous books include CoffeeScript and Async JavaScript, both published by PragProg. You can follow him on Twitter as @trevorburnham.