Unverified Commit 36825349 authored by abdallah akrab's avatar abdallah akrab Committed by GitHub

docs: add jest-environment-jsdom package for Jest configuration (#36632)



## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`

Jest 28 does not include jest-environment-jsdom by default.

following guide & running jest without jest-environment-jsdom causes the following  error:

<img width="1598" alt="image" src="https://user-images.githubusercontent.com/37980706/166319065-2bc29bb4-7d56-43e5-b85d-5a7484f17b1b.png">
parent fec5318e
...@@ -263,10 +263,10 @@ npx create-next-app@latest --example with-jest with-jest-app ...@@ -263,10 +263,10 @@ npx create-next-app@latest --example with-jest with-jest-app
Since the release of [Next.js 12](https://nextjs.org/blog/next-12), Next.js now has built-in configuration for Jest. Since the release of [Next.js 12](https://nextjs.org/blog/next-12), Next.js now has built-in configuration for Jest.
To set up Jest, install `jest` , `@testing-library/react`, `@testing-library/jest-dom`: To set up Jest, install `jest`, `jest-environment-jsdom`, `@testing-library/react`, `@testing-library/jest-dom`:
```bash ```bash
npm install --save-dev jest @testing-library/react @testing-library/jest-dom npm install --save-dev jest jest-environment-jsdom @testing-library/react @testing-library/jest-dom
``` ```
Create a `jest.config.js` file in your project's root directory and add the following: Create a `jest.config.js` file in your project's root directory and add the following:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment