Home / File/ backend-integration.spec.ts — vite Source File

backend-integration.spec.ts — vite Source File

Architecture documentation for backend-integration.spec.ts, a typescript file in the vite codebase. 2 imports, 0 dependents.

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  620d92e1_dd7d_4427_c898_6b1004558e52["backend-integration.spec.ts"]
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  620d92e1_dd7d_4427_c898_6b1004558e52 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  620d92e1_dd7d_4427_c898_6b1004558e52 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 620d92e1_dd7d_4427_c898_6b1004558e52 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, expect, test, vi } from 'vitest'
import {
  browserErrors,
  browserLogs,
  editFile,
  getColor,
  isBuild,
  isServe,
  listAssets,
  page,
  ports,
  readManifest,
  serverLogs,
  untilBrowserLogAfter,
} from '~utils'

test('should have no 404s', () => {
  browserLogs.forEach((msg) => {
    expect(msg).not.toMatch('404')
  })
})

describe('asset imports from js', () => {
  test('file outside root', async () => {
    // assert valid image src https://github.com/microsoft/playwright/issues/6046#issuecomment-1799585719
    await vi.waitUntil(() =>
      page
        .locator('.asset-reference.outside-root .asset-preview')
        .evaluate((el: HTMLImageElement) => el.naturalWidth > 0),
    )

    const text = await page.textContent(
      '.asset-reference.outside-root .asset-url',
    )
    if (isBuild) {
      expect(text).toMatch(/\/dev\/assets\/logo-[-\w]{8}\.png/)
    } else {
      // asset url is prefixed with server.origin
      expect(text).toMatch(
        `http://localhost:${ports['backend-integration']}/dev/@fs/`,
      )
      expect(text).toMatch(/\/dev\/@fs\/.+?\/images\/logo\.png/)
    }
  })
})

describe.runIf(isBuild)('build', () => {
  test('manifest', async () => {
    const manifest = readManifest('dev')
    const htmlEntry = manifest['index.html']
    const mainTsEntry = manifest['main.ts']
    const cssAssetEntry = manifest['global.css']
    const pcssAssetEntry = manifest['foo.pcss']
    const scssAssetEntry = manifest['nested/blue.scss']
    const imgAssetEntry = manifest['../images/logo.png']
    const dirFooAssetEntry = manifest['../../dir/foo.css']
    const customNameAssetEntry = manifest['../../dir/custom.css']
    const iconEntrypointEntry = manifest['icon.png']
    const waterContainerEntry = manifest['water-container.svg']
    expect(htmlEntry.css.length).toEqual(1)
// ... (75 more lines)

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

What does backend-integration.spec.ts do?
backend-integration.spec.ts is a source file in the vite codebase, written in typescript.
What does backend-integration.spec.ts depend on?
backend-integration.spec.ts imports 2 module(s): vitest, ~utils.
Where is backend-integration.spec.ts in the architecture?
backend-integration.spec.ts is located at playground/backend-integration/__tests__/backend-integration.spec.ts (directory: playground/backend-integration/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free