Home / File/ dynamic-import.spec.ts — vite Source File

dynamic-import.spec.ts — vite Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

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

test('should load literal dynamic import', async () => {
  await page.click('.baz')
  await expect.poll(() => page.textContent('.view')).toMatch('Baz view')
})

test('should load full dynamic import from public', async () => {
  await page.click('.qux')
  await expect.poll(() => page.textContent('.view')).toMatch('Qux view')
  // No warning should be logged as we are using @vite-ignore
  expect(
    serverLogs.some((log) => log.includes('cannot be analyzed by vite')),
  ).toBe(false)
})

test('should load data URL of `blob:`', async () => {
  await page.click('.issue-2658-1')
  await expect.poll(() => page.textContent('.view')).toMatch('blob')
})

test('should load data URL of `data:`', async () => {
  await page.click('.issue-2658-2')
  await expect.poll(() => page.textContent('.view')).toMatch('data')
})

test('should have same reference on static and dynamic js import, .mxd', async () => {
  await page.click('.mxd')
  await expect.poll(() => page.textContent('.view')).toMatch('true')
})

// in this case, it is not possible to detect the correct module
test('should have same reference on static and dynamic js import, .mxd2', async () => {
  await page.click('.mxd2')
  await expect.poll(() => page.textContent('.view')).toMatch('false')
})

test('should have same reference on static and dynamic js import, .mxdjson', async () => {
  await page.click('.mxdjson')
  await expect.poll(() => page.textContent('.view')).toMatch('true')
})

// since this test has a timeout, it should be put last so that it
// does not bleed on the last
test('should load dynamic import with vars', async () => {
  await page.click('.foo')
  await expect.poll(() => page.textContent('.view')).toMatch('Foo view')

  await page.click('.bar')
  await expect.poll(() => page.textContent('.view')).toMatch('Bar view')
})

// ... (137 more lines)

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free