vitestGlobalSetup.ts — vite Source File
Architecture documentation for vitestGlobalSetup.ts, a typescript file in the vite codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR bcb6ec17_e7f0_3af5_0251_1a12e1b52d95["vitestGlobalSetup.ts"] a09ff191_7c83_bdcd_30f1_b4e129910bf6["promises"] bcb6ec17_e7f0_3af5_0251_1a12e1b52d95 --> a09ff191_7c83_bdcd_30f1_b4e129910bf6 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] bcb6ec17_e7f0_3af5_0251_1a12e1b52d95 --> 51e96894_3556_ed5c_1ede_97d449867adf c82ca981_198a_5b8d_f19f_a747225ef1cc["node"] bcb6ec17_e7f0_3af5_0251_1a12e1b52d95 --> c82ca981_198a_5b8d_f19f_a747225ef1cc daea26b3_da11_dee8_9ffd_9dbc0e857906["playwright-chromium"] bcb6ec17_e7f0_3af5_0251_1a12e1b52d95 --> daea26b3_da11_dee8_9ffd_9dbc0e857906 style bcb6ec17_e7f0_3af5_0251_1a12e1b52d95 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs/promises'
import path from 'node:path'
import type { TestProject } from 'vitest/node'
import type { BrowserServer } from 'playwright-chromium'
import { chromium } from 'playwright-chromium'
let browserServer: BrowserServer | undefined
export async function setup({ provide }: TestProject): Promise<void> {
browserServer = await chromium.launchServer({
headless: !process.env.VITE_DEBUG_SERVE,
args: process.env.CI
? ['--no-sandbox', '--disable-setuid-sandbox']
: undefined,
})
provide('wsEndpoint', browserServer.wsEndpoint())
const tempDir = path.resolve(import.meta.dirname, '../playground-temp')
await fs.rm(tempDir, { recursive: true, force: true })
await fs.mkdir(tempDir, { recursive: true })
await fs
.cp(path.resolve(import.meta.dirname, '../playground'), tempDir, {
recursive: true,
dereference: false,
filter(file) {
file = file.replace(/\\/g, '/')
return !file.includes('__tests__') && !/dist(?:\/|$)/.test(file)
},
})
.catch(async (error) => {
if (error.code === 'EPERM' && error.syscall === 'symlink') {
throw new Error(
'Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.',
)
} else {
throw error
}
})
// also setup dedicated copy for "variant" tests
for (const [original, variants] of [
['assets', ['encoded-base', 'relative-base', 'runtime-base', 'url-base']],
['css', ['lightningcss']],
['transform-plugin', ['base']],
] as const) {
for (const variant of variants) {
await fs.cp(
path.resolve(tempDir, original),
path.resolve(tempDir, `${original}__${variant}`),
{ recursive: true },
)
}
}
}
export async function teardown(): Promise<void> {
await browserServer?.close()
if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) {
await fs.rm(path.resolve(import.meta.dirname, '../playground-temp'), {
recursive: true,
})
}
}
Domain
Subdomains
Functions
Dependencies
- node
- node:path
- playwright-chromium
- promises
Source
Frequently Asked Questions
What does vitestGlobalSetup.ts do?
vitestGlobalSetup.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in vitestGlobalSetup.ts?
vitestGlobalSetup.ts defines 2 function(s): setup, teardown.
What does vitestGlobalSetup.ts depend on?
vitestGlobalSetup.ts imports 4 module(s): node, node:path, playwright-chromium, promises.
Where is vitestGlobalSetup.ts in the architecture?
vitestGlobalSetup.ts is located at playground/vitestGlobalSetup.ts (domain: ViteCore, subdomain: ConfigEngine, directory: playground).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free