http.spec.ts — vite Source File
Architecture documentation for http.spec.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 40e68c13_4120_3877_005e_df32ffbefc0e["http.spec.ts"] 946bdba3_227b_3fc0_1b4c_ddbdb281f454["node:http"] 40e68c13_4120_3877_005e_df32ffbefc0e --> 946bdba3_227b_3fc0_1b4c_ddbdb281f454 a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 40e68c13_4120_3877_005e_df32ffbefc0e --> a340ba46_b2b7_3048_3bb3_6907a74c8464 2616bf8c_8895_7af5_fb6e_8424b9e71ea7[".."] 40e68c13_4120_3877_005e_df32ffbefc0e --> 2616bf8c_8895_7af5_fb6e_8424b9e71ea7 style 40e68c13_4120_3877_005e_df32ffbefc0e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import http from 'node:http'
import { afterEach, describe, expect, test } from 'vitest'
import { createServer } from '..'
import type { ViteDevServer } from '..'
const BASE_PORT = 15181
describe('port detection', () => {
let blockingServer: http.Server | null = null
let viteServer: ViteDevServer | null = null
afterEach(async () => {
if (viteServer) {
await viteServer.close()
viteServer = null
}
await new Promise<void>((resolve) => {
if (blockingServer) {
blockingServer.close(() => resolve())
blockingServer = null
} else {
resolve()
}
})
})
async function createSimpleServer(port: number, host: string) {
const server = http.createServer()
await new Promise<void>((resolve) => {
server.listen(port, host, () => resolve())
})
return {
[Symbol.asyncDispose]() {
return new Promise<void>((resolve) => {
server.close(() => resolve())
})
},
}
}
describe('port fallback', () => {
test('detects port conflict', async () => {
await using _blockingServer = await createSimpleServer(
BASE_PORT,
'localhost',
)
viteServer = await createServer({
root: import.meta.dirname,
logLevel: 'silent',
server: { port: BASE_PORT, strictPort: false, ws: false },
})
await viteServer.listen()
const address = viteServer.httpServer!.address()
expect(address).toStrictEqual(
expect.objectContaining({ port: BASE_PORT + 1 }),
)
})
// ... (117 more lines)
Dependencies
- ..
- node:http
- vitest
Source
Frequently Asked Questions
What does http.spec.ts do?
http.spec.ts is a source file in the vite codebase, written in typescript.
What does http.spec.ts depend on?
http.spec.ts imports 3 module(s): .., node:http, vitest.
Where is http.spec.ts in the architecture?
http.spec.ts is located at packages/vite/src/node/__tests__/http.spec.ts (directory: packages/vite/src/node/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free