Issue Running Jest Tests

291 views
Skip to first unread message

Brooks Johnson

unread,
Sep 26, 2023, 5:20:50 AM9/26/23
to Illuminated Cloud Q&A
Hi Scott setting up a new machine and trying to run some Jest tests. 

I can verify I have Node installed and jest. I have also run the normal NPM install with a new Salesforce project. 

I am getting a pop-up that I am missing Jest library dependencies from Illuminated Cloud. 
I need to install @Types/Node available for download as Node and @types/jest available for download as Jest. 

I have installed them. But my tests are not working. Not sure if there is a config step I am missing here when IC brings me to the Libraries modal. I don't see them Jest or Node as options I can add. 

Brooks 

Scott

unread,
Sep 26, 2023, 10:07:47 AM9/26/23
to Illuminated Cloud Q&A, Brooks Johnson
Hi, Brooks. I don't know exactly what kinds of problems you're seeing, but I just verified that I'm able to run Jest tests within the IDE with this library configuration:

jest_libs.png

and a run configuration as follows:

jest_run_config.png

but I did have to add one more dependency to "package.json" that was missing or I'd get the following error:

TypeError: Cannot read properties of undefined (reading 'html') at new JSDOMEnvironment

Specifically I added "jest-environment-json" as below and ran "npm install" again to ensure it was available at runtime:

jest_package_json.png

That hasn't been required in the past, but evidently it is now. I'll likely reach out to the CLI team and let them know that, without that, there is a missing dependency at test runtime. They've fixed similar issues in the past when reported.

Regards,
Scott Wells

Brooks Johnson

unread,
Sep 26, 2023, 12:09:11 PM9/26/23
to Illuminated Cloud Q&A, Scott, Brooks Johnson
Mostly a weird config issue on my end. I also installed the new JSDOM. Thanks for reaching out to the CLI team about that. 

Scott

unread,
Sep 26, 2023, 5:27:45 PM9/26/23
to Illuminated Cloud Q&A, Brooks Johnson, Scott
Speaking of that, here's what I logged with them:


Regards,
Scott Wells

Reply all
Reply to author
Forward
0 new messages