-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to ESM #804
Update to ESM #804
Conversation
test/test-setup.js
Outdated
@@ -0,0 +1,3 @@ | |||
import { jest } from '@jest/globals'; | |||
|
|||
global.jest = jest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda ignored this in the other PR but I probably should not have. I don't want this to be considered a standard practice. Globals are a hack, especially with esm modules and are not standard. Its never good or safe to rely on global "this" mutations. Its only really meant for some polyfills stuff and this more about hiding things instead of being explicit which is what we want. Its also kinda why they had to make a package called @jest/globals
because "magic global injection" is agains the esm code standard. We do not gain anything but lose understanding because now these are different from everything else. Also if you need something else out of @jest/globals
how are you going to do it? Are you going to further pollute the global scope for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what the alternative is? What should be done instead?
We are still having problems that weren't as easily overcome as we thought this morning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you mean don't do global.jest = jest
and instead do the import { jest } from '@jest/globals';
in each individual file that needs it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted the last commit, which added jest as a global. Thanks for this input Jared.
This PR makes the following changes:
kafka-assets
andterafoundation_kafka_connector
to ESM.kafka-assets
from version 4.4.1 to 5.0.0terafoundation_kafka_connector
from version 0.14.0 to 1.0.0node-gyp
from version 9.4.1 to 10.1.0@terascope/scripts
from 0.77.2 to 1.0.1,@terascope/job-components
from 0.75.1 to 1.0.1,teraslice-test-harness
from 0.30.0 to 1.0.1,@types/node
from 18.14.2 to 20.14.9,@types/uuid
from 9.0.8 to 10.0.0kafka-assets
dependencies:@terascope/types
from 0.17.2 to 0.17.3,@terascope/job-components
from 0.75.1 to 1.0.1terafoundation_kafka_connector
dev dependency:@terascope/job-components
from 0.75.1 to 1.0.1yarn
from 1.22.19 to 1.22.22