Skip to content
Advertisement

Jest coverage tools fail

During in my react-native project, during test execution, Jest shows coverage and creates coverage reports.

Jest config:

JavaScript

During testing I get errors:

JavaScript

in files which are generated during creation of coverage folder:

JavaScript

So, in jest documentation we see that we can specify jsdom environment in file which produces error like:

JavaScript

Ok, but here we have auto-generated files, not my test-files. How else can I fix these errors?

UPD: these errors does not appear if I delete coverage folder with all files before launching tests.so Jest creates everything good. But when I launch tests with existing “coverage” folder, during update shows errors

Advertisement

Answer

found answer on my question. when you specify jest tests folder as folder to place coverage report there, Jest considers, that coverage folder contains test.on first start when coverage folder does not exist it creates it without problems, but when you repeat coverage command, jest tries to test every js file in it. so coverage folder is needed to be excluded as test location for jest. how to do this you can find here

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement