-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Regression in node axios interception / resolver in 0.38 #1119
Comments
Hey, @tobiasr. Thanks for reporting this! Unfortunately, I can't seem to reproduce the issue using your example above. I've also got some tests for Could you please create a reproduction repository where I can take a look at this? Thanks. |
The example in the post also fails for me: $ npm i msw@0.36
added 4 packages, removed 1 package, changed 3 packages, and audited 1445 packages in 3s
157 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ npm t dummy
> impasse@0.9.0 test
> jest "dummy"
PASS server server/dummy.test.js
✓ mock axios call and return (9 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.264 s, estimated 6 s
Ran all test suites matching /dummy/i.
$ npm i msw@0.38
added 1 package, removed 4 packages, changed 3 packages, and audited 1442 packages in 1s
157 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ npm t dummy
> impasse@0.9.0 test
> jest "dummy"
FAIL server server/dummy.test.js (5.283 s)
✕ mock axios call and return (5001 ms)
● mock axios call and return
thrown: "Exceeded timeout of 5000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
20 | afterAll(() => server.close());
21 |
> 22 | test("mock axios call and return", () => {
| ^
23 | return axios.get("http://localhost/the_endpoint").then(() => {
24 | expect(true).toBe(true);
25 | });
at Object.<anonymous> (server/dummy.test.js:22:1)
at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 5.307 s
Ran all test suites matching /dummy/i. This is with Node 16.14.0/NPM 8.3.1 on macOS 12.2.1. I don't know if it's helpful/related, but I was looking at issues with 0.38 because the upgrade from 0.36.8 caused a bunch of my existing tests to fail by timing out - in that case, as well as the timeout, I also see:
|
Oh, I see. This is an issue related to Node 16 moving the "headers" property of the |
@kettanaito - that issue you mentioned (mswjs/interceptors#212) appears to be merged now into the interceptors library... is it safe to assume the fix has been incorporated in 0.38.2 ? Because I'm still seeing issues with |
Describe the bug
Using a very simple setup results in intercepted requests not resolving in 0.38 . The same code works fine in 0.36.8 .
Environment
msw: 0.38.0
nodejs: 16.14.0
npm: 8.3.1
axios: ^0.26.0
To Reproduce
The following test works on msw 0.36.8 but not in 0.38.0, where the intercepted request doesn't resolve which is reported as a jest async timeout "thrown: "Exceeded timeout of 5000 ms for a test.".
Expected behavior
Expected behaviour is that the test above passes.
The text was updated successfully, but these errors were encountered: