DEV Community

Discussion on: React Testing Library Recipes - Getting started

Collapse
 
esponges profile image
Fernando González Tostado • Edited

There is a typo error in the jest.config.js file, where the property setupFilesAfterEnv has a path that looks for setupTestS.js (plural) and you are instructing to create a file callled setupTest.js (singular) which will cause a not found option when starting the test.

Also, I you already have taken time -thank you- for writing this post, I'd also given some guidance to setup the Babel which is quite simple: babeljs.io/setup#installation -> in babel.config.json add {
"presets": [["@babel/preset-env"], ["@babel/preset-react"]]
}
and done. Otherwise some people will be stuck right after trying to run the first and simplest test.

Collapse
 
mbellagamba profile image
Mirco Bellagamba

Hi, thanks for your feedback! I cannot spot the typo you are talking about 🤔. I see setupTests.js everywhere.

Babel configuration is out of the scope of the article because it's something about project configuration but it's probably useful to remind readers to install @babel/core @babel/preset-env @babel/preset-react and add a babel.config.json like the one you suggested.

{
  "presets": [
    ["@babel/preset-env"], 
    ["@babel/preset-react"]
  ]
}
Enter fullscreen mode Exit fullscreen mode

Everyone interested in complete project configuration can see the repository I shared at the end of the article github.com/mbellagamba/testing-lib....

Collapse
 
esponges profile image
Fernando González Tostado

Yeah... it might have been my own typo, since I never copy/paste code. Thanks for clearing out the very basics for the babel.config.json file. Keep it up!