Skip to content

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

Closed
yaacovCR wants to merge 2 commits into
apollographql:mainfrom
yaacovCR:test-esm
Closed

demonstrate changes to get esm graphql-js working with jest#8082
yaacovCR wants to merge 2 commits into
apollographql:mainfrom
yaacovCR:test-esm

Conversation

@yaacovCR

@yaacovCR yaacovCR commented Jun 19, 2025

Copy link
Copy Markdown

@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

apollo-librarian Bot commented Jun 19, 2025

Copy link
Copy Markdown

❌ Docs preview failed

The preview failed to build.

Build ID: 7ce9a93c138c7e984289a7b7

Errors

General: Failed to fetch GitHub source: OK

@yaacovCR

Copy link
Copy Markdown
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.
@glasser

glasser commented Jul 3, 2025

Copy link
Copy Markdown
Member

#8083 (comment)

@glasser glasser closed this Jul 3, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants