Comments (7)
I will try to reproduce the setup and link the repo when it's ready, thank you !
from msw.
Hi, @Boughris-Abdelmalek. Thanks for reporting this. I will take a look at what's going on and let you know.
from msw.
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.
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.
@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.
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.
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)
- Update Documentation to Include undici Compatibility Issues and Solutions HOT 1
- Allow opting out from automatic processing unhandled exceptions in handlers HOT 4
- Allow customization of network error HOT 1
- Update 2.x removeAllListeners documentation
- Uncaught SyntaxError: Unexpected string (at msw.js?v=2dd0a77b:2057:51) HOT 2
- Getting the OperationName for graphql query
- Trying to pull body in POST mocks breaks mocking HOT 3
- Error: [MSW] Failed to locate the Service Worker registration.
- Issue when no response.url and request is undefined
- msw/node unable to intercept requests from fetch in undici HOT 3
- request.formData() fails with vitest and file HOT 5
- Make bad "Network behavior overrides" more obvious HOT 1
- Optional path parameters do not match correctly HOT 4
- Always results in Network Error when using undici 6.x HOT 1
- Recieving `Network error` after moving to codegen msw handlers, various dependency upgrades and the addition of RTK query.
- Unclear how to throw an actual error HOT 1
- Axios fails to follow redirects from MSW mocked responses HOT 2
- FormData with file fails in with-jest
- Native fetch is intercepted, but openapi-fetch call makes actual request HOT 3
- Cookie with path other than root not sent to handlers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msw.