JavaScript Testing In And Around WordPress

Now that WordPress is partially built with React, and more work is being done to modernize the WordPress interface using React, React is a super important skill for a WordPress developer to learn. Our community is creating great resources on how to learn React -- a highly markettable skill -- and apply this to WordPress.

This next phase in WordPress development — a move to React-powered UIs that are often decoupled from WordPress is great — but requires a serious commitment to automated testing or we will not be able to meet the needs of people visiting our sites or those building them.

This mini-course/ git book/ whatever was orignally developed as a talk for WordCamp New York City 2019. The slides for that talk have small code snippets that I talk about. Since I'm better at writing than talking, I wanted to go into more depth with words and example code.

Consume this site in the form of a slide deck

What You Will learn

This course teaches how to use create-react-app and @wordpress/scripts to build React apps, decoupled from WordPress and in the block editor, using the test-driven development (TDD) methodology. It shows how to build what I call isomorphic blocks. These are blocks that are truely "what you see is what you get". They behave the same in the block editor and the front-end. In addtion, they allow for reuse of components between the WordPress editor, WordPress front-end and any other app. I wrote about this concept in this blog post for Pantheon.

Who This Is For?

In general, this content is designed to be useful for WordPress developers who are learning React and how to use it in the new "Gutenberg" post editor.

In the next section I will cover what I am assuming you know. I'll provide links for good sites to learn what I am assuming you already learned.

I do hope this is useful whether you intend to use WordPress or not.

Who Am I?

Hi, I'm Josh. I make WordPress plugins, as well as React and Laravel apps. Currenlty, I work at Saturday Drive. We make the WordPress plugins Ninja Form, Caldera Forms, SendWP and more. Previously, I was co-owner and lead developer for CalderaWP, where we developed Caldera Forms before it was aquired by Saturday Drive.

I am an occasional contributor to WordPress core and have written a lot about WordPress development for Torque and other sites.

Status

I'd consider this to be minimally viable at this point. Everything I wanted to say, within reason is here. I'd like to add aditional sections. Before that, I'd like to use codesandbox to make the code samples editable.

This site is open source. If you see a typo or any way to imporve it, submit a pull request or click the "Edit On Github" button on each page.