Home / File/ css-sourcemap.spec.ts — vite Source File

css-sourcemap.spec.ts — vite Source File

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

File typescript 3 imports

Entity Profile

Dependency Diagram

graph LR
  a76f5a3e_526c_7fff_38ea_23488d47c5b0["css-sourcemap.spec.ts"]
  6feed3e8_55b8_cce7_b5ef_e40b872585f7["node:url"]
  a76f5a3e_526c_7fff_38ea_23488d47c5b0 --> 6feed3e8_55b8_cce7_b5ef_e40b872585f7
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  a76f5a3e_526c_7fff_38ea_23488d47c5b0 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  a76f5a3e_526c_7fff_38ea_23488d47c5b0 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style a76f5a3e_526c_7fff_38ea_23488d47c5b0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { URL } from 'node:url'
import { describe, expect, test } from 'vitest'
import {
  extractSourcemap,
  formatSourcemapForSnapshot,
  isBuild,
  isServe,
  page,
  serverLogs,
} from '~utils'

test.runIf(isBuild)('should not output sourcemap warning (#4939)', () => {
  serverLogs.forEach((log) => {
    expect(log).not.toMatch('Sourcemap is likely to be incorrect')
  })
})

describe.runIf(isServe)('serve', () => {
  const getStyleTagContentIncluding = async (content: string) => {
    const styles = await page.$$('style')
    for (const style of styles) {
      const text = await style.textContent()
      if (text.includes(content)) {
        return text
      }
    }
    throw new Error('Not found')
  }

  test('linked css', async () => {
    const res = await page.request.get(
      new URL('./linked.css', page.url()).href,
      {
        headers: {
          accept: 'text/css',
        },
      },
    )
    const css = await res.text()
    expect(css).not.toContain('sourceMappingURL')
  })

  test('linked css with import', async () => {
    const res = await page.request.get(
      new URL('./linked-with-import.css', page.url()).href,
      {
        headers: {
          accept: 'text/css',
        },
      },
    )
    const css = await res.text()
    const map = extractSourcemap(css)
    expect(formatSourcemapForSnapshot(map, css)).toMatchInlineSnapshot(`
      SourceMap {
        content: {
          "mappings": "AAAA;EACE,UAAU;AACZ;;ACAA;EACE,UAAU;AACZ",
          "sources": [
            "be-imported.css",
            "linked-with-import.css",
// ... (216 more lines)

Dependencies

  • node:url
  • vitest
  • ~utils

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free