Jest Code Coverage

51 views
Skip to first unread message

Brooks Johnson

unread,
Oct 31, 2023, 10:21:09 AM10/31/23
to Illuminated Cloud Q&A
Hi Scott, I noticed that when I run my Jest tests I am not seeing any code coverage in my IDE. If I click to show the latest coverage data. 

To double check I cloned the Salesforce LWC Recipes repo and ran all tests with coverage. The CLI displayed coverage data. But IntelliJ showed  "135 files not covered"
Not sure if this is a config issue on my end or something else. 
Screenshot 2023-10-31 at 10.20.00 AM.png

Scott

unread,
Oct 31, 2023, 10:40:29 AM10/31/23
to Illuminated Cloud Q&A, Brooks Johnson
Brooks, I'm not sure as I'm unable to reproduce it. I just did the exact same thing and here are my results which include coverage data:

Jest_Coverage.png

Here's the run configuration for that test run:

Jest_Run_Configuration.png

I did have to run "npm install" to ensure that the "Jest package" selected above is available, and of course I also ensured that the "@types/jest" and "@types/node" JavaScript libraries are enabled for the project:

JavaScript_Libs_Config.png

See if you have yours configured in the same fashion. If not, does changing the config resolve the issue? If that doesn't do it, you might need to report it to JetBrains since the Jest test runner and code coverage stuff is part of their JavaScript plugin.

Regards,
Scott Wells

Brooks Johnson

unread,
Oct 31, 2023, 10:56:43 AM10/31/23
to Illuminated Cloud Q&A, Scott, Brooks Johnson
Hi Scott, I was just rushing back to delete this. 

Right after I posted this I got an error that "IntelliJ has been damaged...." On my Mac. I reinstalled and everything is good. 

Scott

unread,
Oct 31, 2023, 11:21:47 AM10/31/23
to Illuminated Cloud Q&A, Brooks Johnson, Scott
Yeesh...that's no fun. Glad you figured it out, but that's not what you want to see...or maybe it is...it's good that it figured out it had problems instead of having numerous other things go wrong without any notion of a solution.

Regards,
Scott Wells

Reply all
Reply to author
Forward
0 new messages