You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running my project within GCP Cloud Build and I'm getting the following error while running tests within Jest via NPM:
Step #1: ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
Step #1:
Step #1: at number (node_modules/gcp-metadata/node_modules/json-bigint/lib/parse.js:208:44)
Step #1: at value (node_modules/gcp-metadata/node_modules/json-bigint/lib/parse.js:397:41)
Step #1: at object (node_modules/gcp-metadata/node_modules/json-bigint/lib/parse.js:367:27)
Step #1: at value (node_modules/gcp-metadata/node_modules/json-bigint/lib/parse.js:389:16)
Step #1: at Function.parse (node_modules/gcp-metadata/node_modules/json-bigint/lib/parse.js:410:14)
When I look at the lines in gcp-metadata/node_modules/json-bigint/lib/parse.js:208 it seems that there's a require('BigNumber') which I think is causing the above issue in my test:
I'm also importing BigNumber within my own project (in fact, in the tests that this error occurs, it's for functionality that I've built that relies on BigNumber) so I'm in a weird tricky spot where a dependency is doing magical things (gcp-metadata is being invoked during the test /somehow/) and a dependency of that (json-bigint) has an error which is completely halting my CI deployment process.
It seems like BigNumber should just be required at the top of the script (where you have var BigNumber = null) and avoid the inline import with conditional check on line 208. The conditional check seems like it should only require BigNumber if _options.useNativeBigInt is false.
The text was updated successfully, but these errors were encountered:
I'm running my project within GCP Cloud Build and I'm getting the following error while running tests within Jest via NPM:
When I look at the lines in
gcp-metadata/node_modules/json-bigint/lib/parse.js:208
it seems that there's arequire('BigNumber')
which I think is causing the above issue in my test:https://github.com/sidorares/json-bigint/blob/master/lib/parse.js#L208
I'm also importing BigNumber within my own project (in fact, in the tests that this error occurs, it's for functionality that I've built that relies on BigNumber) so I'm in a weird tricky spot where a dependency is doing magical things (
gcp-metadata
is being invoked during the test /somehow/) and a dependency of that (json-bigint
) has an error which is completely halting my CI deployment process.It seems like BigNumber should just be required at the top of the script (where you have
var BigNumber = null
) and avoid the inline import with conditional check on line 208. The conditional check seems like it should only require BigNumber if_options.useNativeBigInt
is false.The text was updated successfully, but these errors were encountered: