Node 18 and @octokit/core v5.0.0 incompatability
Describe the bug
Moctokit does not work with Node 18. All .reply responses return the same result to Octokit. Setting the status as 200 and 404 do not differ the mock response`
I believe this is due to Node 18 using a new http client named undici for fetch API support
Looking at the code for Moctokit it uses nock, which has an open issue for undici support
To Reproduce
Use Moctokit with Node 18 and @octokit/core v5.0.0
Expected behavior Proper mock responses are returned.
Additional context
I don't actually expect this to be solved until Nock is updated but an incompatibility note in the README would be nice.
Thank you for pointing this out. I will keep an eye out for this or see if there are any alternative because of https://github.com/nock/nock/issues/2397#issuecomment-1673676783
I will update the docs till then.
I have updated the docs but will keep this issue open
experimental support for fetch added to nock. I will soon start testing compatibility of this with mock-github
https://github.com/nock/nock/issues/2397#issuecomment-1925478357
Not sure if I'm doing anything wrong, but I upgraded the latest main of this project, ran npm add nock@beta and got all tests to pass with minimal effort. I'll send a PR.
Hey everyone, so sorry for the delay but thanks to @oliversalzburg a beta version of mock-github is available that supports mocking of the inbuilt fetch client in node 18 and up. It is currently beta since we depend on nock's beta release. Once nock releases a more stable version than I shall make a general release
I upgraded all my actions to use the new beta and all tests are passing. I don't have many tests yet, because I was waiting for this project to work flawlessly, but what's there works :smile:
I noticed that I need to pass { request: { fetch } } explicitly to getOctoKit in my tests to make it work though. I don't understand yet why that is.