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

fix: node 18 native fetch support #344

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

moltar
Copy link
Contributor

@moltar moltar commented Feb 17, 2023

This is just a quick POC, not an actual final implementation.

Looks like there is an issue on the Polly side:

Tests throw with:

    TypeError: Cannot assign to read only property 'Request' of object '[object global]'

      32 | // eslint-disable-next-line jest/require-top-level-describe
      33 | beforeEach(() => {
    > 34 |   jestPollyContext.polly.configure(jestPollyConfigService.config)
         |                          ^
      35 |   jestPollyContext.polly.server
      36 |     .any()
      37 |     .on('beforePersist', (request, recording: PollyRecording) => {

      at FetchAdapter.onConnect (node_modules/@pollyjs/adapter-fetch/src/index.js:53:5)
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (src/jest-polly.ts:34:26)

Which seems to be coming from here:

https://github.com/Netflix/pollyjs/blob/2d7f0f33d9f552e78f0dfe81179751b4692357be/packages/%40pollyjs/adapter-fetch/src/index.js#L53

Closes #342

@moltar
Copy link
Contributor Author

moltar commented Feb 17, 2023

Looks like Polly node adapter is using nock, which does not yet have support for Node 18.

See this issue, which links to two other issues: nock/nock#2397

@moltar
Copy link
Contributor Author

moltar commented Aug 18, 2023

Might be part-solved by #388

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.

Is jest-polly compatible with Node 18.3+ fetch
1 participant