rsnext/examples/with-jest-babel/README.md

30 lines
854 B
Markdown
Raw Normal View History

# Next.js + Jest
This example shows how to configure Jest to work with Next.js and Babel. Since the release of Next.js 12, Next.js has in-built configuration for Jest with SWC. See the [with-jest](https://github.com/vercel/next.js/tree/canary/examples/with-jest) example for the latest implementation.
This includes Next.js' built-in support for Global CSS, CSS Modules and TypeScript.
## How to Use
Quickly get started using [Create Next App](https://github.com/vercel/next.js/tree/canary/packages/create-next-app#readme)!
In your terminal, run the following command:
```bash
npx create-next-app --example with-jest-babel with-jest-babel-app
```
```bash
yarn create next-app --example with-jest-babel with-jest-babel-app
```
```bash
pnpm create next-app --example with-jest-babel with-jest-babel-app
```
## Run Jest Tests
```bash
npm test
```