Skip to content
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

Merged
merged 16 commits into from
Jul 3, 2024
Merged

Update to ESM #804

merged 16 commits into from
Jul 3, 2024

Conversation

busma13
Copy link
Contributor

@busma13 busma13 commented Jun 25, 2024

This PR makes the following changes:

  • Convert kafka-assets and terafoundation_kafka_connector to ESM.
  • Bump kafka-assets from version 4.4.1 to 5.0.0
  • Bump terafoundation_kafka_connector from version 0.14.0 to 1.0.0
  • Bump top level dependency: node-gyp from version 9.4.1 to 10.1.0
  • Bump top level dev dependencies: @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.0
  • Bump kafka-assetsdependencies: @terascope/types from 0.17.2 to 0.17.3, @terascope/job-components from 0.75.1 to 1.0.1
  • Bump terafoundation_kafka_connector dev dependency: @terascope/job-components from 0.75.1 to 1.0.1
  • Bump yarn from 1.22.19 to 1.22.22

@busma13 busma13 marked this pull request as draft June 25, 2024 23:41
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals';

global.jest = jest;
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

@busma13 busma13 marked this pull request as ready for review July 3, 2024 19:37
@busma13 busma13 requested review from godber, jsnoble and sotojn July 3, 2024 19:37
@busma13 busma13 changed the title Update to esm Update to ESM Jul 3, 2024
@busma13 busma13 self-assigned this Jul 3, 2024
@godber godber merged commit 84580d1 into master Jul 3, 2024
4 checks passed
@godber godber deleted the update-to-esm branch July 3, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants