Home / File/ tailwind.spec.ts — vite Source File

tailwind.spec.ts — vite Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import { expect, test } from 'vitest'
import { editFile, getColor, isServe, page, untilBrowserLogAfter } from '~utils'

test('should render', async () => {
  expect(await page.textContent('#pagetitle')).toBe('Page title')
})

test.runIf(isServe)(
  'full reload happens when the HTML is changed',
  async () => {
    await expect
      .poll(() => getColor('.html'))
      .toBe('oklch(0.623 0.214 259.815)')

    editFile('index.html', (code) =>
      code.replace('"html text-blue-500"', '"html text-green-500"'),
    )
    await expect
      .poll(() => getColor('.html'))
      .toBe('oklch(0.723 0.219 149.579)')
  },
)

test.runIf(isServe)('regenerate CSS and HMR (glob pattern)', async () => {
  const el = page.locator('#view1-text')
  expect(await getColor(el)).toBe('oklch(0.627 0.194 149.214)')

  await untilBrowserLogAfter(
    () =>
      editFile('src/views/view1.js', (code) =>
        code.replace('|view1|', '|view1 updated|'),
      ),
    [
      '[vite] css hot updated: /index.css',
      '[vite] hot updated: /src/views/view1.js via /src/main.js',
    ],
    false,
  )
  await expect.poll(() => el.textContent()).toMatch('|view1 updated|')

  await untilBrowserLogAfter(
    () =>
      editFile('src/views/view1.js', (code) =>
        code.replace('text-green-600', 'text-orange-600'),
      ),
    [
      '[vite] css hot updated: /index.css',
      '[vite] hot updated: /src/views/view1.js via /src/main.js',
    ],
    false,
  )
  await expect.poll(() => getColor(el)).toBe('oklch(0.646 0.222 41.116)')
})

test.runIf(isServe)(
  'same file duplicated in module graph (#4267)',
  async () => {
    const el = page.locator('#component1')
    expect(await getColor(el)).toBe('oklch(0.577 0.245 27.325)')

    // when duplicated, page reload happens
    await untilBrowserLogAfter(
      () =>
        editFile('src/components/component1.js', (code) =>
          code.replace('text-red-600', 'text-blue-600'),
        ),
      [
        '[vite] css hot updated: /index.css',
        '[vite] hot updated: /src/components/component1.js',
      ],
      false,
    )
    await expect.poll(() => getColor(el)).toBe('oklch(0.546 0.245 262.881)')
  },
)

test.runIf(isServe)('regenerate CSS and HMR (relative path)', async () => {
  const el = page.locator('#pagetitle')
  expect(await getColor(el)).toBe('oklch(0.541 0.281 293.009)')

  await untilBrowserLogAfter(
    () =>
      editFile('src/main.js', (code) =>
        code.replace('text-violet-600', 'text-cyan-600'),
      ),
    ['[vite] css hot updated: /index.css', '[vite] hot updated: /src/main.js'],
    false,
  )
  await expect.poll(() => getColor(el)).toBe('oklch(0.609 0.126 221.723)')
})

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free