
In the past few months, I've had the immense pleasure to work with what I can say is my favorite library to use in the React + Friends environment,...
For further actions, you may consider blocking this person and/or reporting abuse
I believe the latest version of RTL has
cleanup
already baked-in.Also,
jest-dom
has been scoped to@testing-library
.So, instead of adding the following to
setupTests.js
(or *.ts):You should:
And then only need to include the following in your
setupTests.js
(or *.ts):also note (from docs):
cleanup
is only done automaticallyif the testing framework you're using supports the afterEach global (like mocha, Jest, and Jasmine). If not, you will need to do manual cleanups after each test.
I having a lot of problems with import
I think you have it installed incorrectly, my
package.json
looks like:Did you add
jest-dom
with:Yes, I dont know why it was installed like that... I've followed the docs, but now it is working fine, thank you :)
I think using “getting started” in the header is misleading.. just as you’ve said - “...this guide is a step by step walkthrough on how to set up your testing environment...”.
The “getting started” part is misleading people into thinking that they’ll learn how to actually test using these tools 🤷🏼♂️
Might be a good idea to change that part of the title to “setting up..”?
Thanks for the feedback, I think you are right! I just changed it to what you suggested :)
Thank you for taking my input politely ☺️
First of all, great article.
@aromanarguello I am having trouble with jest.config.js in create-react-app configuration.
It would be very nice if you could help me.
Why is this showing me an error whenever I am trying to do
npm test
?This is my
npm test
command inpackage.json
: