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

nock does't work in bun #8781

Open
panva opened this issue Feb 8, 2024 · 3 comments
Open

nock does't work in bun #8781

panva opened this issue Feb 8, 2024 · 3 comments
Labels
bug Something isn't working needs investigate Needs to be investigated to find the root cause

Comments

@panva
Copy link
Contributor

panva commented Feb 8, 2024

What version of Bun is running?

1.0.26+c75e768a6

What platform is your computer?

No response

What steps can reproduce the bug?

gh repo clone nock/nock
cd nock
bun install
bun run ./node_modules/.bin/mocha --recursive tests

What is the expected behavior?

The nock test suite passes, indicating that nock can be used in project test suites to check if they work in bun or not.

What do you see instead?

  • incomplete test output
  • failures almost everywhere

Additional information

It is impossible for modules that have existing test suite for the Node.js runtime to test and assert their module works in Bun if the test suite doesn't even run in Bun. nock is a very common library for mocking http responses for the node:http and node:https modules.

@panva panva added the bug Something isn't working label Feb 8, 2024
@Electroid Electroid added the needs investigate Needs to be investigated to find the root cause label Feb 8, 2024
@JulianKingman
Copy link

JulianKingman commented Apr 2, 2024

In version 1.0.4, I got this error: #5006

Now in version 1.1.0, I get this error:

96 |     req.path = options.path
         ^
TypeError: Attempted to assign to readonly property.
      at attachToReq (/Users/Julian/Projects//node_modules/nock/lib/intercepted_request_router.js:96:5)
      at new InterceptedRequestRouter (/Users/Julian/Projects//node_modules/nock/lib/intercepted_request_router.js:73:5)
      at new OverriddenClientRequest (/Users/Julian/Projects//node_modules/nock/lib/intercept.js:290:25)
      at /Users/Julian/Projects//node_modules/nock/lib/intercept.js:426:14
      at /Users/Julian/Projects//node_modules/nock/lib/common.js:91:14
      at /Users/Julian/Projects//node_modules/@smithy/node-http-handler/dist-cjs/index.js:294:19
      at new Promise (:1:21)
      at /Users/Julian/Projects//node_modules/@smithy/node-http-handler/dist-cjs/index.js:245:12

Probably related: #8368

@dougludlow
Copy link

I'm seeing the exact same error as above in v1.1.2.

@rafaell-lycan
Copy link

I just got the same error as well on v1.1.26 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigate Needs to be investigated to find the root cause
Projects
None yet
Development

No branches or pull requests

5 participants