Skip to content

Commit

Permalink
docs: Add skeleton for cra post
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh95 committed May 17, 2022
1 parent 2e89229 commit dc72664
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions website/blog/2022-05-18-first-class-support-cra/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
slug: first-class-support-cra
title: First class support for Create React App
authors: [nvh95]
tags: [jest-preview, developer-experience, create-react-app]
# TODO To update
# image: /img/automatic-mode.png
---

CRA is well known for bootstrapping a React App. It hides the complexity of bundling and configuration over `react-scripts`. However, in some scenarios, it's very hard to customize CRA for a specific purpose. Make Jest Preview works seamlessly with CRA is an example. Currently, there is no way to customize CRA's `jest.config.js` file easily. So, Jest Preview bundles a few CLIs to make integrating Jest Preview to CRA easier.

Option 1: Use codemod:

- Run this CLI `jest-preview config-cra-test`

Option 2: Configure manually

1. Create `jest.config.js`

- Create `jest.config.js` with following content:

1. Update test script in `package.json`

```diff
{
"scripts": {
- "test": "react-scripts test"
+ "test": "node scripts/test.js"
}
}
```

1. Create test script

0 comments on commit dc72664

Please sign in to comment.