Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode Test Explorer unable to run tests #593

Closed
1 task done
drmacm opened this issue Jan 26, 2024 · 3 comments
Closed
1 task done

VSCode Test Explorer unable to run tests #593

drmacm opened this issue Jan 26, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@drmacm
Copy link

drmacm commented Jan 26, 2024

Summary

After cloning the repo, VSCode's Test Explorer is unable to run the tests in the app.
The tests work when running npm run test:unit in terminal.

Fixed by running npm install jest-environment-jsdom --save-dev.

I can submit a PR with extra dependency if you agree with the approach.

Salesforce Org Type

Scratch Org

Steps To Reproduce

  1. Clone the repo
  2. Open it with VSCode
  3. Run npm install
  4. Run npm run test:unit and observe that the tests pass
  5. Open VSTest Explorer click on "Run all" icon

Current Behavior

All tests fail

Expected Behavior

All tests pass

Relevant Log Output

● Test suite failed to run

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

      at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:72:44)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@drmacm drmacm added the bug Something isn't working label Jan 26, 2024
Copy link
Contributor

Thank you for posting this issue. 🙇🏼‍♂️
We will come back to you shortly.

@albarivas
Copy link
Collaborator

Hello,

This issue occurs because Jest v28 stopped bundling the extra jest-environment-jsdom dependency. This is required for LWC, and has been pre-packaged by sfdx-lwc-jest.
I'll update sfdx-lwc-jest to get it fixed.

Thanks for your contribution!

@albarivas
Copy link
Collaborator

Fixed on #594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants