jest-mongodb
jest-mongodb copied to clipboard
TypeError: Class extends value undefined is not a constructor or null
Jest v29 and this package v3 & v4 fail with all tests:
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (node_modules/@shelf/jest-mongodb/lib/environment.js:15:70)
at Object.newLoader (node_modules/pirates/lib/index.js:141:7)
at ScriptTransformer.requireAndTranspileModule (node_modules/@jest/transform/build/ScriptTransformer.js:772:66)
Rolling back to v2 works as expected.
I'm getting the same
"jest": "^26.6.3",
Bumping this up.
Same here
Updating jest-environment-node
to the same version of jest fixed this for me. But now getting a different error.
getting same error though.
The problem is that the export TestEnvironment
from jest-environment-node
only exists after version v28
. So either you'll need to upgrade your jest-environment-node
, or downgrade jest-mongodb
to v2
.
It's the same for me.
I have a monorepo with package depending on @shelf/jest-mongodb@"^4.1.7", and other package depending via a dependency on jest-environment-node@"^27.5.1". The @shelf/jest-mongodb@"^4.1.7" and jest-environment-node@"^27.5.1" both get hoisted up to the root node_modules.
Since the @shelf/jest-mongodb depends on the TestEnvironment export, which is not exported in the jest-environment-node@"^27.5.1", I believe the peerDependencies.jest-environment-node of "27.x.x || 28.x || 29.x" is incorrect.
For now I worked around this by adding devDependencies "jest-environment-node": "^29.5.0" to the root package.json.