Skip to content

demonstrate changes to get esm graphql-js working with jest #8082

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yaacovCR
Copy link

@yaacovCR yaacovCR commented Jun 19, 2025

@glasser

strategy: use babel to transform our dependency

(A) globally: add @babel/preset-env as a devDependency to support 3 below

(B) in package using an esm dependency such as graphql canary:

  1. switch our "ts-jest" preset to "ts-jest/presets/js-with-babel"
  2. override the default transformIgnorePatterns with an exception for our package of interest
  3. add a babel config file with the @babel/preset-env preset targetting node

-- The babel config files could be a base + override like the other configs in this repo, but it is pretty abbreviated, and this is just a demonstration, so I held off.

context: graphql/graphql-js#4437

@apollo-librarian
Copy link

apollo-librarian bot commented Jun 19, 2025

❌ Docs preview failed

The preview failed to build.

Build ID: 7ce9a93c138c7e984289a7b7

Errors

General: Failed to fetch GitHub source: OK

@yaacovCR
Copy link
Author

Failing tests seem to be the expected ones secondary to the node version restrictions within the graphql-js esm canary.

strategy: use babel to transform our dependency

(A) globally: add @babel/preset-env as a devDependency to support 3 below

(B) in package using an esm dependency such as graphql canary:
1. switch our "ts-jest" preset to "ts-jest/presets/js-with-babel"
2. override the default transformIgnorePatterns with an exception for our package of interest
3. add a babel config file with the @babel/preset-env preset targetting node

-- The babel config files could be a base + override like the other configs in this repo, but it is pretty abbreviated, and this is just a demonstration, so I held off.
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.

1 participant