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

csp.spec.ts — vite Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

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

test('linked css', async () => {
  expect(await getColor('.linked')).toBe('blue')
})

test('inline style tag', async () => {
  expect(await getColor('.inline')).toBe('green')
})

test('imported css', async () => {
  expect(await getColor('.from-js')).toBe('blue')
})

test('dynamic css', async () => {
  expect(await getColor('.dynamic')).toBe('red')
})

test('script tag', async () => {
  await expect.poll(() => page.textContent('.js')).toBe('js: ok')
})

test('dynamic js', async () => {
  await expect
    .poll(() => page.textContent('.dynamic-js'))
    .toBe('dynamic-js: ok')
})

test('inline js', async () => {
  await expect.poll(() => page.textContent('.inline-js')).toBe('inline-js: ok')
})

test('nonce attributes are not repeated', async () => {
  const htmlSource = await page.content()
  expect(htmlSource).not.toContain(/nonce=""[^>]*nonce=""/)
  await expect
    .poll(() => page.textContent('.double-nonce-js'))
    .toBe('double-nonce-js: ok')
})

test('meta[property=csp-nonce] is injected', async () => {
  const meta = await page.$('meta[property=csp-nonce]')
  expect(await (await meta.getProperty('nonce')).jsonValue()).not.toBe('')
})

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free