mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
45 lines
1.2 KiB
Markdown
45 lines
1.2 KiB
Markdown
---
|
|
title: browser.orchestratorScripts | Config
|
|
outline: deep
|
|
---
|
|
|
|
# browser.orchestratorScripts
|
|
|
|
- **Type:** `BrowserScript[]`
|
|
- **Default:** `[]`
|
|
|
|
Custom scripts that should be injected into the orchestrator HTML before test iframes are initiated. This HTML document only sets up iframes and doesn't actually import your code.
|
|
|
|
The script `src` and `content` will be processed by Vite plugins. Script should be provided in the following shape:
|
|
|
|
```ts
|
|
export interface BrowserScript {
|
|
/**
|
|
* If "content" is provided and type is "module", this will be its identifier.
|
|
*
|
|
* If you are using TypeScript, you can add `.ts` extension here for example.
|
|
* @default `injected-${index}.js`
|
|
*/
|
|
id?: string
|
|
/**
|
|
* JavaScript content to be injected. This string is processed by Vite plugins if type is "module".
|
|
*
|
|
* You can use `id` to give Vite a hint about the file extension.
|
|
*/
|
|
content?: string
|
|
/**
|
|
* Path to the script. This value is resolved by Vite so it can be a node module or a file path.
|
|
*/
|
|
src?: string
|
|
/**
|
|
* If the script should be loaded asynchronously.
|
|
*/
|
|
async?: boolean
|
|
/**
|
|
* Script type.
|
|
* @default 'module'
|
|
*/
|
|
type?: string
|
|
}
|
|
```
|