Go Pro Sign Up Login

Buy Now and unlock this series

$

39

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Introduction To Testing With Jest

In this video, we are going to setup Jest and write some boilerplate code so we can better understand how Jest works. We will create fake test functions so we can get a feel of how Jest works and apply these concepts in actual React code later in the series.

https://github.com/leveluptuts/Level-Up-JavaScript-Testing-101

git clone https://github.com/leveluptuts/Level-Up-JavaScript-Testing-101.git
cd Level-Up-JavaScript-Testing-101
npm install
npm test

Downloads

Become a pro to download code and videos

Comments

Lukie

over 1 year ago

I had the following issue when running npm install for the repo:

jest --watchAll

Error: fsevents unavailable (this watcher can only be used on Darwin) at new FSEventsWatcher (..../Level-Up-JavaScript-Testing-101/node_modules/sane/src/fsevents_watcher.js:41:11)

I did some googling and found my solution was to uninstall watchman and then reinstall it using brew as shown below:

npm r -g watchman brew install watchman

From : https://stackoverflow.com/questions/52427810/error-fsevents-unavailable-this-watcher-can-only-be-used-on-darwin

In case that trips up anyone else.

Weronika

about 2 years ago

@Christian Can confirm this solution is working (as of 1.09.20) :)

User avatar

Scott

over 2 years ago

If you are having trouble getting started with this repo, delete the package-lock.json and everything will install fine. I'll remove that in the repo just in case.

Ausar McGruder

almost 3 years ago [edited]

This starter repo doesn't work. Here's how to make it work..

  1. git clone https://github.com/leveluptuts/Level-Up-JavaScript-Testing-101.git
  2. cd Level-Up-JavaScript-Testing-101
  3. open the project in a text editor (I like VS Code)
  4. brew install watchman
  5. In your package.json file, change "parcel-bundler" to "parcel".
  6. npm install
  7. npm test

Christian

about 3 years ago

To everyone doing this course. After cloning the repo don't run npm install right away. Open package.json and change the dependency name of "parcel-bundler" to "parcel". After that, run npm install and npm run start and the project should work normally

Christian

about 3 years ago

@Si There is a video about this in his youtube channel. Check the What Is playlist

Si

over 3 years ago
  1. What's the difference between unit testing, integration testing and UI/E2E testing, specially in context of React.
  2. Am I right in thinking cypress and jest+react-testing-library are covering the same ground, i.e. testing from the users perspective? Is there a need to use both?

Want to join the conversation?

Become a Pro member today!