Home / File/ assets-relative-base.spec.ts — vite Source File

assets-relative-base.spec.ts — vite Source File

Architecture documentation for assets-relative-base.spec.ts, a typescript file in the vite codebase. 2 imports, 0 dependents.

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  93f880d5_d282_3e0b_2641_6c17d330b4e2["assets-relative-base.spec.ts"]
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  93f880d5_d282_3e0b_2641_6c17d330b4e2 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  93f880d5_d282_3e0b_2641_6c17d330b4e2 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 93f880d5_d282_3e0b_2641_6c17d330b4e2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { beforeAll, describe, expect, test } from 'vitest'
import {
  browserLogs,
  findAssetFile,
  getBg,
  getColor,
  isBuild,
  page,
} from '~utils'

const absoluteAssetMatch = isBuild
  ? /http.*\/other-assets\/asset-[-\w]{8}\.png/
  : '/nested/asset.png'

// Asset URLs in CSS are relative to the same dir, the computed
// style returns the absolute URL in the test
const cssBgAssetMatch = absoluteAssetMatch

const iconMatch = `/icon.png`

const absoluteIconMatch = isBuild
  ? /http.*\/icon-[-\w]{8}\.png/
  : '/nested/icon.png'

const absolutePublicIconMatch = isBuild ? /http.*\/icon\.png/ : '/icon.png'

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

describe('raw references from /public', () => {
  test('load raw js from /public', async () => {
    expect(await page.textContent('.raw-js')).toMatch('[success]')
  })

  test('load raw css from /public', async () => {
    expect(await getColor('.raw-css')).toBe('red')
  })
})

test('import-expression from simple script', async () => {
  expect(await page.textContent('.import-expression')).toMatch(
    '[success][success]',
  )
})

describe('asset imports from js', () => {
  test('relative', async () => {
    expect(await page.textContent('.asset-import-relative')).toMatch(
      cssBgAssetMatch,
    )
  })

  test('absolute', async () => {
    expect(await page.textContent('.asset-import-absolute')).toMatch(
      cssBgAssetMatch,
    )
  })
// ... (185 more lines)

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free