Code Monkey home page Code Monkey logo

Comments (3)

kettanaito avatar kettanaito commented on June 29, 2024 2

I have a hard requirement to import fetch directly from the undici package.

That shouldn't be a problem.

Also, the node built-in fetch does not allow passing a dispatcher directly, unlike fetch from undici.

TIL!

No worries, let's reopen this then.

from msw.

TheHolyWaffle avatar TheHolyWaffle commented on June 29, 2024 1

@kettanaito Thanks for looking into this.

I have removed the polyfills again in the minimal reproduction. They were a futile attempt to fix my issue but they never made sense. This bug purely revolves around a nodejs backend microservice, no jsdom environment is needed.

I have a hard requirement to import fetch directly from the undici package. This is because the node built-in version of fetch is from an older undici version. Since then, there have been bugs fixed in undici. Also, the node built-in fetch does not allow passing a dispatcher directly, unlike fetch from undici. Because of these reasons, I cannot use the global fetch.

Please reconsider this issue 🙏

from msw.

kettanaito avatar kettanaito commented on June 29, 2024

Hi, @TheHolyWaffle. Thanks for reporting this.

Please, compare your usage example to the Jest and Jest+JSDOM examples from MSW. Those are functional (as functional as anything on JSDOM can get).

You don't have to import fetch from undici explicitly if you have this line.

I also highly recommend to drop jest.polyfills.js and use jest-fixed-jsdom preset instead. Try that and let me know if you still encounter the issue.

from msw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.