GithubHelp home page GithubHelp logo

Comments (7)

Boughris-Abdelmalek avatar Boughris-Abdelmalek commented on June 18, 2024 2

I will try to reproduce the setup and link the repo when it's ready, thank you !

from msw.

kettanaito avatar kettanaito commented on June 18, 2024

Hi, @Boughris-Abdelmalek. Thanks for reporting this. I will take a look at what's going on and let you know.

from msw.

kettanaito avatar kettanaito commented on June 18, 2024

Running with-jest example with Yarn

with-jest % yarn test
yarn run v1.22.19
warning package.json: No license field
$ jest
 PASS  ./example.test.ts
 PASS  ./example-jsdom.test.ts

Test Suites: 2 passed, 2 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        0.937 s
Ran all test suites.
✨  Done in 3.01s.

There are no issues running the latest with-jest example using Yarn.

Please make sure you follow the example. You have to configure additional things to make Jest run modern JavaScript.

from msw.

Boughris-Abdelmalek avatar Boughris-Abdelmalek commented on June 18, 2024

Hi, @Boughris-Abdelmalek. Thanks for reporting this. I will take a look at what's going on and let you know.

Just for more context, I having issues when running yarn start && yarn build, the tests works fine.

My setup uses:
msw: 2.0.14 jest: 29.7.0 react-scripts: 5.0.1 yarn: 4.0.2 node: (I tried different versions from 18 >)

If you need more informations please let me know :)

I followed the documentation about the setup, I would love to give you more informations about the repo I am using but as it is a private one from my company it's unfortunately not possible, thank you for your understanding.

from msw.

kettanaito avatar kettanaito commented on June 18, 2024

@Boughris-Abdelmalek, I'm not sure I follow. The Jest example doesn't have the start and build scripts, those must be yours. Do you want to submit a reproduction repository for me to look at? The one you mentioned in the OP works fine.

I understand you cannot share your company's project. I encourage you to extract the setup into a standalone repo and submit that. Omit any sensitive data. Yes, it will take time. The upside here is that you are highly likely to discover the root cause of the issue and fix it yourself while extracting it to a standalone repo.

from msw.

Boughris-Abdelmalek avatar Boughris-Abdelmalek commented on June 18, 2024

Hello @kettanaito , so here is the repo with the exact error reproduced, I hope this will be helpful !

https://[email protected]/Boughris-Abdelmalek/msw-1965-bug

Thank you in advance for your time :)

from msw.

Boughris-Abdelmalek avatar Boughris-Abdelmalek commented on June 18, 2024

Hello @kettanaito , so here is the repo with the exact error reproduced, I hope this will be helpful !

https://[email protected]/Boughris-Abdelmalek/msw-1965-bug

Thank you in advance for your time :)

I think I found the issue, I have a pathResolve function in <rootDir>/src/utils that basically checks if the app is running on browser or node, and It seems like it's what was causing the issue.

The import somehow was conflicting and declaring the function on top of the handlers resolves it.

I don't know if it's supposed to behave like this or it was my mistake but I hope that this can be helpful !

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.