Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/interceptors/ClientRequest/MockHttpSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
this.emit('error', error)
}

return super.destroy(error)

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with utf-8". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with utf8". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with utf16le". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with ucs-2". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with ucs2". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with latin1". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with hex". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with binary". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (20)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:836:20 ❯ _destroy ../node:internal/streams/destroy:121:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:83:5 ❯ MockHttpSocket.Writable.destroy ../node:internal/streams/writable:1122:11 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:638:28 ❯ MockHttpSocket.emit ../node:events:536:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with base64". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with utf-8". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with utf8". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with utf16le". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with ucs-2". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with ucs2". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with latin1". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with hex". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with binary". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 167 in src/interceptors/ClientRequest/MockHttpSocket.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unhandled error

TypeError: Cannot assign to read only property '_handle' of object '#<MockHttpSocket>' ❯ MockHttpSocket.Socket._destroy ../node:net:840:20 ❯ _destroy ../node:internal/streams/destroy:109:10 ❯ MockHttpSocket.destroy ../node:internal/streams/destroy:71:5 ❯ MockHttpSocket.destroy ../src/interceptors/ClientRequest/MockHttpSocket.ts:167:18 ❯ Object.onceWrapper ../node:events:631:28 ❯ MockHttpSocket.emit ../node:events:529:35 ❯ processTicksAndRejections ../node:internal/process/task_queues:95:5 This error originated in "modules/http/compliance/http-res-set-encoding.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "reads the response body encoded with base64". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
}

/**
Expand All @@ -181,6 +181,19 @@
const socket = this.createConnection()
this.originalSocket = socket

/**
* @note Inherit the original socket's connection handle.
* Without this, each push to the mock socket results in a
* new "connection" listener being added (i.e. buffering pushes).
* @see https://github.com/nodejs/node/blob/b18153598b25485ce4f54d0c5cb830a9457691ee/lib/net.js#L734
*/
if ('_handle' in socket) {
Object.defineProperty(this, '_handle', {
value: socket._handle,
enumerable: true,
})
}

// If the developer destroys the socket, destroy the original connection.
this.once('error', (error) => {
socket.destroy(error)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @vitest-environment node
/**
* @see https://github.com/mswjs/interceptors/pull/706
*/
import { it, expect, beforeAll, afterAll } from 'vitest'
import http from 'node:http'
import { HttpServer } from '@open-draft/test-server/http'
import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest'
import { waitForClientRequest } from '../../../helpers'

const httpServer = new HttpServer((app) => {
app.get('/', (_req, res) => {
// Triggers 2 reads in the MockHttpSocket
res.write('hello')
res.flushHeaders()
res.write(' world')
res.end()
})
})

const interceptor = new ClientRequestInterceptor()

beforeAll(async () => {
interceptor.apply()
await httpServer.listen()
})

afterAll(async () => {
interceptor.dispose()
await httpServer.close()
})

it('does not buffer socket pushes for a passthrough request', async () => {
const request = http.get(httpServer.http.url('/'))
const { text } = await waitForClientRequest(request)

await expect(text()).resolves.toBe('hello world')
expect(
request.socket?.listenerCount('connect'),
'Must not add "connection" listeners to the socket. Those listeners mean no "_handle" exists on the mock socket.'
).toBe(0)
})
Loading