Home / File/ legacy-styles-only-entry-watch.spec.ts — vite Source File

legacy-styles-only-entry-watch.spec.ts — vite Source File

Architecture documentation for legacy-styles-only-entry-watch.spec.ts, a typescript file in the vite codebase. 2 imports, 0 dependents.

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  2ac9f686_bcb4_0ed9_3f34_959199a79831["legacy-styles-only-entry-watch.spec.ts"]
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  2ac9f686_bcb4_0ed9_3f34_959199a79831 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  2ac9f686_bcb4_0ed9_3f34_959199a79831 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 2ac9f686_bcb4_0ed9_3f34_959199a79831 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { expect, test } from 'vitest'
import {
  editFile,
  findAssetFile,
  isBuild,
  notifyRebuildComplete,
  readManifest,
  watcher,
} from '~utils'

test.runIf(isBuild)('rebuilds styles only entry on change', async () => {
  expect(findAssetFile(/style-only-entry-.+\.css/, 'watch')).toContain(
    '#ff69b4',
  )
  expect(findAssetFile(/style-only-entry-legacy-.+\.js/, 'watch')).toContain(
    '#ff69b4',
  )
  expect(findAssetFile(/polyfills-legacy-.+\.js/, 'watch')).toBeTruthy()
  const numberOfManifestEntries = Object.keys(readManifest('watch')).length
  expect(numberOfManifestEntries).toBe(3)

  editFile('style-only-entry.css', (originalContents) =>
    originalContents.replace('#ff69b4', '#ffb6c1'),
  )
  await notifyRebuildComplete(watcher)

  const updatedManifest = readManifest('watch')
  expect(Object.keys(updatedManifest)).toHaveLength(numberOfManifestEntries)

  // We must use the file referenced in the manifest here,
  // since there'll be different versions of the file with different hashes.
  const reRenderedCssFile = findAssetFile(
    updatedManifest['style-only-entry.css']!.file.substring('assets/'.length),
    'watch',
  )
  expect(reRenderedCssFile).toContain('#ffb6c1')
  const reRenderedCssLegacyFile = findAssetFile(
    updatedManifest['style-only-entry-legacy.css']!.file.substring(
      'assets/'.length,
    ),
    'watch',
  )
  expect(reRenderedCssLegacyFile).toContain('#ffb6c1')
  expect(findAssetFile(/polyfills-legacy-.+\.js/, 'watch')).toBeTruthy()
})

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free