DEV Community

Discussion on: How to Create and Publish a React Component Library

Collapse
 
walachian profile image
Ovidiu-Deliu

For the Jest part, while attempting to run the tests script you might encounter the error:

Test environment jest-environment-jsdom cannot be found. Make sure the testEnvironment configuration option points to an existing node module.

Configuration Documentation:
jestjs.io/docs/configuration

As of Jest 28 "jest-environment-jsdom" is no longer shipped by default, make sure to install it separately.

As the error says, the package for jest-environment-jsdom isn't bundled anymore with the base jest library, so you'll have to install it separately with:

npm install jest-environment-jsdom --save-dev

Happy coding ;)

Some comments have been hidden by the post's author - find out more