Error: Cannot find module '@jest/globals'
tomsoal opened this issue ยท 7 comments
Remember, an issue is not the place to ask questions. You can use
Stack Overflow for that, or
you may want to start a discussion on dW Answers.
Before you open an issue, please check if a similar issue already exists or has been closed before.
Hi,
Since change #275 was merged, our downstream dependencies using this repo are failing with the following error:
Exception during run: Error: Cannot find module '@jest/globals'
code: 'MODULE_NOT_FOUND',
requireStack: [
'/opt/ibm/app/node_modules/ibm-cloud-sdk-core/lib/sdk-test-helpers.js',
'/opt/ibm/app/node_modules/ibm-cloud-sdk-core/index.js',
Assuming this would likely be breaking your internal building suite too.
I think the change here should be as simple as adding @jest/globals
to your package.json and this should resolve things.
Thank you!
When reporting a bug, please be sure to include the following:
- Steps to reproduce
- Expected behavior - should install successfully
- Actual behavior - fails to install
- Node version - 18
- SDK version
When you open an issue for a feature request, please add as much detail as possible:
- A descriptive title starting with the service name
- A description of the problem you're trying to solve
- A suggested solution if possible
What is the reason for using @jest/globals
at run time? That's a unit testing library, it's very unusual to use it outside of development.
@dpopp07 we also observe this issue with the 4.3.2
core in our SDK.
It looks like
Line 21 in a5c3e08
sdk-test-helpers
. It means the test dependencies are seemingly not isolated to the test code like I thought when I commented in #266 (comment). I guess that means removing the test deps from the prod dep tree will require a more invasive change afterall.In our code example, we just instantiate the BasicAuthenticator as per const { BasicAuthenticator } = require('ibm-cloud-sdk-core')
As the above comment mentions, the actual import seems to happen from the code inside of this repo
This has broken our builds. We're in the midst of pinning to ibm-cloud-sdk-core@4.3.1
, but if you were able to revert #275 and ship a new patch as soon as possible that would be extremely helpful.
Thanks all for the report. This change didn't go as planned. I'll be investigating why all of my tests pulling this change into other repos and builds were successful when this clearly caused widespread problems.
PR to revert is open here: #277
I guess that means removing the test deps from the prod dep tree will require a more invasive change afterall.
@ricellis Yes, it looks like that is the case. We will probably look to publish a new major release of the core soon without the test utilities and publish the test utils as a separate package, to be installed as a dev dependency in the SDKs. This will necessitate some churn in the SDK projects as they move to upgrade but it will at least be less unexpected due to the major version change.
๐ This issue has been resolved in version 4.3.3 ๐
The release is available on:
npm package (@latest dist-tag)
- GitHub release
Your semantic-release bot ๐ฆ๐