It returns me Cannot find module './dist/extend-expect' from 'extend-expect.js'
even when it is installed =/
"devDependencies": {
"@testing-library/dom": "^6.4.0",
"@testing-library/jest-dom": "github:testing-library/jest-dom",
"@testing-library/react": "^9.1.4",
also note (from docs): cleanup is only done automatically if 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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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):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 :)
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.