bencompton / jest-cucumber

Execute Gherkin scenarios in Jest
Apache License 2.0
662 stars 118 forks source link

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

Closed robinelvin closed 7 months ago

robinelvin commented 1 year ago

Adding jest-cucumber to my Jest@29.6.3 project throws this error:

 FAIL  test/contexts/mysql/Users.test.ts
  ● Test suite failed to run

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

      at new NodeEnvironment (../../node_modules/jest-environment-node/build/index.js:87:49)

Removing jest-cucumber makes it work again.

tegandbiscuits commented 8 months ago

I'm using Yarn and was able to work around this issue by setting a resolution in my package.json (swapping the version for whatever version of Jest you're using).

"resolutions": {
  "jest-cucumber/jest": "^29.7.0"
}

I'm not sure how universal this fix is, or if a later version of Jest will break things again. The root of the issue is that jest-cucumber depends on an old version of Jest (26).

pplancq commented 7 months ago

@robinelvin Following the release of version 4.0.4 jest is now a peerDependencies which allows you to install the version of jest you want.

This issue can be closed