-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Interception is no longer working since v2.0.6 #1930
Comments
Hi, @ribeaud. Thanks for reporting this. I see nothing in 2.0.6 - 2.0.11 releases that could have caused this. From the brief look at the repo, your setup seems to be okay. I recommend following the Debugging runbook to see if you can uncover any issues. Please do so and let me know what each step yields. Thanks. |
Hi @kettanaito. Thanks for the pointer. I will follow the steps and let you know. |
Hi @kettanaito. Thank you so much. This was, indeed, very useful. I've found out the problem. Our generated API have a response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); If I remove the last part To me it looks like msw gets stricter after 2.0.6. Could you confirm? Is that something I have to solve on my side? Or do you think this could trigger a change in msw library? |
@ribeaud, I don't believe MSW has any changes affecting this. Do you observe any request difference when passing I suspect that may affect how |
@kettanaito, Mmmmh... This is really weird. Changing the dependency to 2.0.6, Now trying your suggestion with |
Setting init to |
I just saw something interesting: after |
If I force my openapi code to use |
It is probably not an issue with Things I would do:
Obviously this may not be possible in your environment, but would strongly push for that. |
Just gave this a try using > jest src/components/admin/PgpKeyInfoManage.test.tsx
PASS src/components/admin/PgpKeyInfoManage.test.tsx (5.767 s)
PgpKeyInfoManage
✓ Should only show edit button for keys with allowedPgpKeyInfoStatusEnumSubset (217 ms) The reproduction scenario is passing. I conclude this issue resolved. If you encounter any other problems, feel free to comment below. Thanks. |
Prerequisites
Environment check
msw
versionNode.js version
v20.10.0
Reproduction repository
https://gitlab.com/biomedit/portal/-/tree/main/frontend
Reproduction steps
package.json
, change msw to v2.0.11, runnpm i
PgpKeyInfoManage.test.tsx
:npm test -- src/components/admin/PgpKeyInfoManage.test.tsx
Current behavior
The test is failing since v2.0.6. For some reason I do not understand yet, the interception is no longer working. We are using a mix of msw, OpenAPI Generator, jest and react.
I went through the release notes and I have no clue which change could be responsible for this behavior.
Expected behavior
In a perfect world, the defined interception works and my test is green, as it used to be.
The text was updated successfully, but these errors were encountered: