Home / File/ ssr.spec.ts — vite Source File

ssr.spec.ts — vite Source File

Architecture documentation for ssr.spec.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  13695079_f941_395c_e689_b4ebc539e363["ssr.spec.ts"]
  06115f6c_ad20_9395_4c5f_19aeb51d9f01["serve.ts"]
  13695079_f941_395c_e689_b4ebc539e363 --> 06115f6c_ad20_9395_4c5f_19aeb51d9f01
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  13695079_f941_395c_e689_b4ebc539e363 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  13695079_f941_395c_e689_b4ebc539e363 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 13695079_f941_395c_e689_b4ebc539e363 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { expect, test } from 'vitest'
import { port, serverLogs } from './serve'
import { browserLogs, editFile, isServe, page } from '~utils'

const url = `http://localhost:${port}`

test(`circular dependencies modules doesn't throw`, async () => {
  await page.goto(`${url}/circular-dep`)

  expect(await page.textContent('.circ-dep-init')).toMatch(
    'circ-dep-init-a circ-dep-init-b',
  )
})

test(`circular import doesn't throw (1)`, async () => {
  await page.goto(`${url}/circular-import`)

  expect(await page.textContent('.circ-import')).toMatchInlineSnapshot(
    '"A is: __A__"',
  )
})

test(`circular import doesn't throw (2)`, async () => {
  await page.goto(`${url}/circular-import2`)

  expect(await page.textContent('.circ-import')).toMatchInlineSnapshot(
    '"A is: __A__"',
  )
})

test(`deadlock doesn't happen for static imports`, async () => {
  await page.goto(`${url}/forked-deadlock-static-imports`)

  expect(await page.textContent('.forked-deadlock-static-imports')).toMatch(
    'rendered',
  )
})

test(`deadlock doesn't happen for dynamic imports`, async () => {
  await page.goto(`${url}/forked-deadlock-dynamic-imports`)

  expect(await page.textContent('.forked-deadlock-dynamic-imports')).toMatch(
    'rendered',
  )
})

test(`import.meta.resolve is supported`, async () => {
  await page.goto(`${url}/import-meta`)

  const metaUrl = await page.textContent('.import-meta-url')
  expect(metaUrl).not.toBe('')
  expect(await page.textContent('.import-meta-resolve')).toBe(metaUrl)
})

test(`import.meta.main is supported`, async () => {
  await page.goto(`${url}/import-meta`)

  expect(await page.textContent('.import-meta-main')).toBe('false')
})

test.runIf(isServe)('html proxy is encoded', async () => {
  await page.goto(
    `${url}?%22%3E%3C/script%3E%3Cscript%3Econsole.log(%27html%20proxy%20is%20not%20encoded%27)%3C/script%3E`,
  )

  expect(browserLogs).not.toContain('html proxy is not encoded')
})

// run this at the end to reduce flakiness
test.runIf(isServe)('should restart ssr', async () => {
  editFile('./vite.config.ts', (content) => content)
  await expect
    .poll(() => {
      expect(serverLogs).toEqual(
        expect.arrayContaining([expect.stringMatching('server restarted')]),
      )
      expect(serverLogs).not.toEqual(
        expect.arrayContaining([expect.stringMatching('error')]),
      )
    })
    .toSatisfy(() => true)
})

Domain

Dependencies

Frequently Asked Questions

What does ssr.spec.ts do?
ssr.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does ssr.spec.ts depend on?
ssr.spec.ts imports 3 module(s): serve.ts, vitest, ~utils.
Where is ssr.spec.ts in the architecture?
ssr.spec.ts is located at playground/ssr/__tests__/ssr.spec.ts (domain: ViteCore, directory: playground/ssr/__tests__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free