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

ssr-pug.spec.ts — vite Source File

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

Entity Profile

Dependency Diagram

graph LR
  6167cd94_1735_44bf_fed4_dd59c166295d["ssr-pug.spec.ts"]
  5c0af01c_9641_2df9_06f7_af0530839340["serve.ts"]
  6167cd94_1735_44bf_fed4_dd59c166295d --> 5c0af01c_9641_2df9_06f7_af0530839340
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  6167cd94_1735_44bf_fed4_dd59c166295d --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  6167cd94_1735_44bf_fed4_dd59c166295d --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 6167cd94_1735_44bf_fed4_dd59c166295d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

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

describe('injected inline scripts', () => {
  test('no injected inline scripts are present', async () => {
    await page.goto(url)
    const inlineScripts = await page.$$eval('script', (nodes) =>
      nodes.filter((n) => !n.getAttribute('src') && n.innerHTML),
    )
    expect(inlineScripts).toHaveLength(0)
  })

  test('injected script proxied correctly', async () => {
    await page.goto(url)
    const proxiedScripts = await page.$$eval('script', (nodes) =>
      nodes
        .filter((n) => {
          const src = n.getAttribute('src')
          if (!src) return false
          return src.includes('?html-proxy&index')
        })
        .map((n) => n.getAttribute('src')),
    )

    // assert at least 1 proxied script exists
    expect(proxiedScripts).not.toHaveLength(0)

    const scriptContents = await Promise.all(
      proxiedScripts.map((src) => fetch(url + src).then((res) => res.text())),
    )

    // all proxied scripts return code
    for (const code of scriptContents) {
      expect(code).toBeTruthy()
    }
  })
})

Domain

Dependencies

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free