Unit testing node.js with jest broke today: `Cannot read properties of undefined (reading 'testEnvironmentOptions')`

I regularly use goland to unit-test single tests in node.js files using jest as our testing framework.

Today I started getting this error message at the start of any run or debug session:
```

Test suite failed to run

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

     at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:66:28)
     at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
     at async runJest (node_modules/@jest/core/build/runJest.js:404:19)
     at async _run10000 (node_modules/@jest/core/build/cli/index.js:320:7)
     at async runCLI (node_modules/@jest/core/build/cli/index.js:173:3)
```

If I roll back two a git commit from a month ago I still get this error, so it looks more likely that it's on the IDE side than the jest side (and they've already said it's not their problem).

 

Unfortunately I can't copy the command-line that appears in the Run window because it disappears after a few seconds, but it currently is basically this:

```
@vue/cli-service test:unit --testNamePattern=<CURRENT-FILENAME-BASENAME> \
<CURRENT-DESCRIPTION> …
```

Did something change in the last few days, and was quietly installed in a pushed upgrade (I don't recall getting recently prompted for an upgrade, but I did reboot my mac the other day).

1

Found a fix. For some reason my Jest package was set to `node_modules/@vue/cli-service`. Changing it to `node_modules/jest` fixes the problem. No idea how that got changed.

2

请先登录再写评论。