Skip to content

Add regression test for got compression issue - Do not merge#2665

Open
AndyMJones wants to merge 1 commit intomswjs:mainfrom
AndyMJones:auth0-infinite-hang
Open

Add regression test for got compression issue - Do not merge#2665
AndyMJones wants to merge 1 commit intomswjs:mainfrom
AndyMJones:auth0-infinite-hang

Conversation

@AndyMJones
Copy link
Contributor

@AndyMJones AndyMJones commented Feb 27, 2026

PR demonstrates a regression test for #2200 and #1468 which has the same root cause. Since this test adds a dependency i would not recommend merging it but demonstrates how i was testing the problem.

As mentioned in my comment on the issue. The root cause was an old version of got and the old interceptors library having a clash. This has been fixed in newer versions.

** see my comment below to why this is the case for Auth0

To verify I checked out the old version (v1.3.5) and built it. In the latest version I then removed the lib folder and used the lib folder from the old version in its place. I then removed all the other test files from the folder (to avoid dealing with broken references) and ran the following -

> msw@2.12.7 test:node /Users/amjones/dev/aii-msw/aii-msw
> vitest --config=./test/node/vitest.config.ts "--dir" "test/node/regressions"


 DEV  v4.0.13 /Users/amjones/dev/aii-msw/aii-msw

stderr | test/node/regressions/1468-compression.test.ts > regression #2200: works before and after starting MSW server
[MSW] Warning: captured a request without a matching request handler:

  • GET http://localhost:1234/test/60

If you still wish to intercept this unhandled request, please create a request handler for it.
Read more: https://mswjs.io/docs/getting-started/mocks
[MSW] Warning: captured a request without a matching request handler:

  • GET http://localhost:1234/test/60

If you still wish to intercept this unhandled request, please create a request handler for it.
Read more: https://mswjs.io/docs/getting-started/mocks

 ❯ test/node/regressions/1468-compression.test.ts (1 test | 1 failed) 5012ms
   × regression #2200: works before and after starting MSW server 5010ms

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  test/node/regressions/1468-compression.test.ts > regression #2200: works before and after starting MSW server
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/node/regressions/1468-compression.test.ts:53:1
     51| }
     52| 
     53| it('regression #2200: works before and after starting MSW server', async () => {
       | ^
     54|   // First: no MSW interceptors active
     55|   await sendRequests(1)

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯


 Test Files  1 failed (1)
      Tests  1 failed (1)
   Start at  11:45:29
   Duration  6.48s (transform 133ms, setup 0ms, collect 1.33s, tests 5.01s, environment 0ms, prepare 10ms)

 FAIL  Tests failed. Watching for file changes...
       press h to show help, press q to quit

Hopefully this is enough to prove that #1468 can be closed and this pr can then just closed without merging.

@AndyMJones
Copy link
Contributor Author

On reflection of my message, I don't think I adequately described why it was a got problem when using Auth0.

The client library of Auth0, under the hood, uses got to make a connection to the official Auth0 service. The response to that request is large and is compressed using http compression. When mocking is enabled, this then results in the response hanging as per #2200.

The hanging was caused by an issue between got and the interceptors library which has been fixed by either / both sides, hence using both old versions for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant