Home / File/ fs-serve-base.spec.ts — vite Source File

fs-serve-base.spec.ts — vite Source File

Architecture documentation for fs-serve-base.spec.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  ca877794_5f58_638a_6443_e32b6a06193e["fs-serve-base.spec.ts"]
  f19ff479_9a29_9dfa_2aae_56203a34253f["safe.json"]
  ca877794_5f58_638a_6443_e32b6a06193e --> f19ff479_9a29_9dfa_2aae_56203a34253f
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  ca877794_5f58_638a_6443_e32b6a06193e --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  ca877794_5f58_638a_6443_e32b6a06193e --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style ca877794_5f58_638a_6443_e32b6a06193e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { beforeAll, describe, expect, test } from 'vitest'
import testJSON from '../../safe.json'
import { isServe, page, viteTestUrl } from '~utils'

const stringified = JSON.stringify(testJSON)

describe.runIf(isServe)('main', () => {
  beforeAll(async () => {
    const srcPrefix = viteTestUrl.endsWith('/') ? '' : '/'
    await page.goto(viteTestUrl + srcPrefix + 'src/', {
      // while networkidle is discouraged, we use here because we're not using playwright's retry-able assertions,
      // and refactoring the code below to manually retry would be harder to read.
      waitUntil: 'networkidle',
    })
  })

  test('default import', async () => {
    await expect.poll(() => page.textContent('.full')).toBe(stringified)
  })

  test('named import', async () => {
    await expect.poll(() => page.textContent('.named')).toBe(testJSON.msg)
  })

  test('safe fetch', async () => {
    expect(await page.textContent('.safe-fetch')).toMatch('KEY=safe')
    await expect.poll(() => page.textContent('.safe-fetch-status')).toBe('200')
  })

  test('safe fetch with query', async () => {
    expect(await page.textContent('.safe-fetch-query')).toMatch('KEY=safe')
    await expect
      .poll(() => page.textContent('.safe-fetch-query-status'))
      .toBe('200')
  })

  test('safe fetch with special characters', async () => {
    expect(
      await page.textContent('.safe-fetch-subdir-special-characters'),
    ).toMatch('KEY=safe')
    await expect
      .poll(() =>
        page.textContent('.safe-fetch-subdir-special-characters-status'),
      )
      .toBe('200')
  })

  test('unsafe fetch', async () => {
    expect(await page.textContent('.unsafe-fetch')).toMatch('403 Restricted')
    await expect
      .poll(() => page.textContent('.unsafe-fetch-status'))
      .toBe('403')
  })

  test('unsafe fetch with special characters (#8498)', async () => {
    await expect.poll(() => page.textContent('.unsafe-fetch-8498')).toBe('')
    await expect
      .poll(() => page.textContent('.unsafe-fetch-8498-status'))
      .toBe('404')
  })
// ... (81 more lines)

Domain

Dependencies

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free