firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
264 stars 124 forks source link

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

Closed luisaverza closed 1 year ago

luisaverza commented 1 year ago

Problem My project is configure to use testEnvironment: 'jsdom', so when I run the tests with vscode-just-runner I find this error:

  - 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)

It is a known problem after updating jest from v27 to v28 The solution will be pretty much to add the jest-environment-jsdom library. I could send a PR adding the lib but I'm not sure if this could impact others that don't use jsdom environment.

firsttris commented 1 year ago

hey @luisaverza

is it enough to add jest-environment-jsdom to your project, or do we need to add it to vscode-jest-runner extension?

at the end jest-runner is just creating the cli command to execute jest.

but jest and everything is used from your acutal project.

please provide feedback :+1:

luisaverza commented 1 year ago

Hey @firsttris thanks for you quick reply! Yes, you are right. Since I work in a monorepo I was having a hard time configuring jest-runner. After setting the ProjectPath and the right jest command, everything is running great! Thanks ✅