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

chore: fix jest esm tests #1797

Draft
wants to merge 5 commits into
base: test/use-esm
Choose a base branch
from

Conversation

rostyk-kanafotskyy
Copy link

What/Why/How?

This update to the jest.config.ts and the addition of setup-jest.js includes several modifications, focusing on enabling ESM (ECMAScript Module) support for Jest and updating how configurations are applied. Here’s a summary of the key changes:

  • ESM Configuration in ts-jest:
    • The useESM: true setting was placed within globals.ts-jest which is now deprecated.
  • A new setup file, setup-jest.js, is created to handle ESM-related setup for Jest. It imports jest from @jest/globals and assigns it to global.jest, making Jest functions available globally in the ESM environment.
  • Additional Config Changes:
    • setupFiles in jest.config.ts now includes setup-jest.js, ensuring it runs before tests to properly set up Jest in the ESM environment.

These changes should help in achieving a smooth transition to ESM, particularly with module compatibility in Jest.

Reference

Testing

Screenshots (optional)

Check yourself

  • Code changed? - Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests
  • New package installed? - Tested in different environments (browser/node)

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

@rostyk-kanafotskyy rostyk-kanafotskyy requested a review from a team as a code owner November 7, 2024 15:31
Copy link

changeset-bot bot commented Nov 7, 2024

⚠️ No Changeset found

Latest commit: 0fa19f9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tatomyr tatomyr marked this pull request as draft November 7, 2024 15:33
@tatomyr
Copy link
Contributor

tatomyr commented Nov 7, 2024

Note: this is a continuation of #1742.

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.

2 participants