diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bae9ce02fa3e..b043692271de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: test-browser: needs: changed - name: 'Browser: ${{ matrix.browser[0] }}, ${{ matrix.os }}' + name: 'Browsers: node-20, ${{ matrix.os }}' if: needs.changed.outputs.should_skip != 'true' runs-on: ${{ matrix.os }} @@ -133,10 +133,6 @@ jobs: os: - macos-latest - windows-latest - browser: - - [chromium, chrome] - - [firefox, firefox] - - [webkit] fail-fast: false timeout-minutes: 30 @@ -149,26 +145,19 @@ jobs: node-version: 20 - uses: browser-actions/setup-chrome@v1 - if: ${{ matrix.browser[0] == 'chromium' }} - uses: browser-actions/setup-firefox@v1 - if: ${{ matrix.browser[0] == 'firefox' }} - name: Install run: pnpm i - name: Install Playwright Dependencies - run: pnpm exec playwright install ${{ matrix.browser[0] }} --with-deps --only-shell + run: pnpm exec playwright install --with-deps --only-shell - name: Build run: pnpm run build - name: Test Browser (playwright) run: pnpm run test:browser:playwright - env: - BROWSER: ${{ matrix.browser[0] }} - name: Test Browser (webdriverio) run: pnpm run test:browser:webdriverio - if: ${{ matrix.browser[1] }} - env: - BROWSER: ${{ matrix.browser[1] }} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 246443e63853..991389fe0374 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -67,6 +67,7 @@ export default ({ mode }: { mode: string }) => { groupIconVitePlugin({ customIcon: { 'CLI': 'vscode-icons:file-type-shell', + 'vitest.shims': 'vscode-icons:file-type-vitest', 'vitest.workspace': 'vscode-icons:file-type-vitest', 'vitest.config': 'vscode-icons:file-type-vitest', '.spec.ts': 'vscode-icons:file-type-testts', @@ -214,6 +215,27 @@ export default ({ mode }: { mode: string }) => { }, ], }, + { + text: 'Configuration', + collapsed: false, + items: [ + { + text: 'Browser Config Reference', + link: '/guide/browser/config', + docFooterText: 'Browser Config Reference | Browser Mode', + }, + { + text: 'Configuring Playwright', + link: '/guide/browser/playwright', + docFooterText: 'Configuring Playwright | Browser Mode', + }, + { + text: 'Configuring WebdriverIO', + link: '/guide/browser/webdriverio', + docFooterText: 'Configuring WebdriverIO | Browser Mode', + }, + ], + }, { text: 'API', collapsed: false, @@ -245,6 +267,17 @@ export default ({ mode }: { mode: string }) => { }, ], }, + { + text: 'Guides', + collapsed: false, + items: [ + { + text: 'Multiple Setups', + link: '/guide/browser/multiple-setups', + docFooterText: 'Multiple Setups | Browser Mode', + }, + ], + }, { items: [ ...footer(), diff --git a/docs/.vitepress/scripts/cli-generator.ts b/docs/.vitepress/scripts/cli-generator.ts index b71dfa5c3ad4..4f3ba4fe06cb 100644 --- a/docs/.vitepress/scripts/cli-generator.ts +++ b/docs/.vitepress/scripts/cli-generator.ts @@ -75,7 +75,7 @@ const options = resolveOptions(cliOptionsConfig) const template = options.map((option) => { const title = option.title const cli = option.cli - const config = skipConfig.has(title) ? '' : `[${title}](/config/#${title.toLowerCase().replace(/\./g, '-')})` + const config = skipConfig.has(title) ? '' : `[${title}](${title.includes('browser.') ? '/guide/browser/config' : '/config/'}#${title.toLowerCase().replace(/\./g, '-')})` return `### ${title}\n\n- **CLI:** ${cli}\n${config ? `- **Config:** ${config}\n` : ''}\n${option.description}\n` }).join('\n') diff --git a/docs/advanced/api/vitest.md b/docs/advanced/api/vitest.md index cb8582ba970f..ad6861e9b98f 100644 --- a/docs/advanced/api/vitest.md +++ b/docs/advanced/api/vitest.md @@ -34,7 +34,6 @@ Vitest 3 is one step closer to stabilising the public API. To achieve that, we d - `changeNamePattern` - `changeFilenamePattern` - `rerunFailed` -- `updateSnapshot` - `_createRootProject` (renamed to `_ensureRootProject`, but still private) - `filterTestsBySource` (this was moved to the new internal `vitest.specifications` instance) - `runFiles` (use [`runTestSpecifications`](#runtestspecifications) instead) @@ -326,6 +325,14 @@ function runTestSpecifications( This method emits `reporter.onWatcherRerun` and `onTestsRerun` events, then it runs tests with [`runTestSpecifications`](#runtestspecifications). If there were no errors in the main process, it will emit `reporter.onWatcherStart` event. +## updateSnapshot + +```ts +function updateSnapshot(files?: string[]): Promise +``` + +Update snapshots in specified files. If no files are provided, it will update files with failed tests and obsolete snapshots. + ## collectTests ```ts diff --git a/docs/api/index.md b/docs/api/index.md index 42ff30eb1f96..30dffaab226e 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -146,7 +146,7 @@ test.skipIf(isDev)('prod only test', () => { ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### test.runIf @@ -166,7 +166,7 @@ test.runIf(isDev)('dev only test', () => { ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### test.only @@ -231,7 +231,7 @@ test.concurrent('test 2', async ({ expect }) => { ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### test.sequential @@ -289,7 +289,7 @@ test.fails('fail test', async () => { ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### test.each @@ -390,7 +390,7 @@ Vitest processes `$values` with Chai `format` method. If the value is too trunca ::: ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### test.for @@ -800,7 +800,7 @@ describe.runIf(isDev)('dev only test suite', () => { ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### describe.only @@ -874,7 +874,7 @@ describe.concurrent('suite', () => { ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### describe.sequential @@ -930,7 +930,7 @@ describe.shuffle('suite', () => { `.skip`, `.only`, and `.todo` works with random suites. ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ### describe.todo @@ -995,7 +995,7 @@ describe.each` ``` ::: warning -You cannot use this syntax, when using Vitest as [type checker](/guide/testing-types). +You cannot use this syntax when using Vitest as [type checker](/guide/testing-types). ::: ## Setup and Teardown diff --git a/docs/config/index.md b/docs/config/index.md index c4d6ed1ca9b5..6d0e1cab56a5 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -1481,7 +1481,26 @@ Do not show files with 100% statement, branch, and function coverage. #### coverage.thresholds -Options for coverage thresholds +Options for coverage thresholds. + +If a threshold is set to a positive number, it will be interpreted as the minimum percentage of coverage required. For example, setting the lines threshold to `90` means that 90% of lines must be covered. + +If a threshold is set to a negative number, it will be treated as the maximum number of uncovered items allowed. For example, setting the lines threshold to `-10` means that no more than 10 lines may be uncovered. + + +```ts +{ + coverage: { + thresholds: { + // Requires 90% function coverage + functions: 90, + + // Require that no more than 10 lines are uncovered + lines: -10, + } + } +} +``` ##### coverage.thresholds.lines @@ -1490,7 +1509,6 @@ Options for coverage thresholds - **CLI:** `--coverage.thresholds.lines=` Global threshold for lines. -See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. ##### coverage.thresholds.functions @@ -1499,7 +1517,6 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-threshol - **CLI:** `--coverage.thresholds.functions=` Global threshold for functions. -See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. ##### coverage.thresholds.branches @@ -1508,7 +1525,6 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-threshol - **CLI:** `--coverage.thresholds.branches=` Global threshold for branches. -See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. ##### coverage.thresholds.statements @@ -1517,7 +1533,6 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-threshol - **CLI:** `--coverage.thresholds.statements=` Global threshold for statements. -See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. ##### coverage.thresholds.perFile @@ -1535,7 +1550,7 @@ Check thresholds per file. - **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.thresholds.autoUpdate=` -Update all threshold values `lines`, `functions`, `branches` and `statements` to configuration file when current coverage is above the configured thresholds. +Update all threshold values `lines`, `functions`, `branches` and `statements` to configuration file when current coverage is better than the configured thresholds. This option helps to maintain thresholds when coverage is improved. ##### coverage.thresholds.100 @@ -1739,221 +1754,17 @@ Open Vitest UI (WIP) Listen to port and serve API. When set to true, the default port is 51204 -### browser {#browser} - -- **Type:** `{ enabled?, name?, provider?, headless?, api? }` -- **Default:** `{ enabled: false, headless: process.env.CI, api: 63315 }` -- **CLI:** `--browser`, `--browser=`, `--browser.name=chrome --browser.headless` +### browser experimental {#browser} -Run Vitest tests in a browser. We use [WebdriverIO](https://webdriver.io/) for running tests by default, but it can be configured with [browser.provider](#browser-provider) option. +- **Default:** `{ enabled: false }` +- **CLI:** `--browser=`, `--browser.name=chrome --browser.headless` -::: tip NOTE -Read more about testing in a real browser in the [guide page](/guide/browser/). -::: +Configuration for running browser tests. Please, refer to the ["Browser Config Reference"](/guide/browser/config) article. ::: warning This is an experimental feature. Breaking changes might not follow SemVer, please pin Vitest's version when using it. ::: -#### browser.enabled - -- **Type:** `boolean` -- **Default:** `false` -- **CLI:** `--browser`, `--browser.enabled=false` - -Run all tests inside a browser by default. - -#### browser.name - -- **Type:** `string` -- **CLI:** `--browser=safari` - -Run all tests in a specific browser. Possible options in different providers: - -- `webdriverio`: `firefox`, `chrome`, `edge`, `safari` -- `playwright`: `firefox`, `webkit`, `chromium` -- custom: any string that will be passed to the provider - -#### browser.headless - -- **Type:** `boolean` -- **Default:** `process.env.CI` -- **CLI:** `--browser.headless`, `--browser.headless=false` - -Run the browser in a `headless` mode. If you are running Vitest in CI, it will be enabled by default. - -#### browser.isolate - -- **Type:** `boolean` -- **Default:** `true` -- **CLI:** `--browser.isolate`, `--browser.isolate=false` - -Run every test in a separate iframe. - -#### browser.testerHtmlPath 2.1.4 {#browser-testerhtmlpath} - -- **Type:** `string` -- **Default:** `@vitest/browser/tester.html` - -A path to the HTML entry point. Can be relative to the root of the project. This file will be processed with [`transformIndexHtml`](https://vite.dev/guide/api-plugin#transformindexhtml) hook. - -#### browser.api - -- **Type:** `number | { port?, strictPort?, host? }` -- **Default:** `63315` -- **CLI:** `--browser.api=63315`, `--browser.api.port=1234, --browser.api.host=example.com` - -Configure options for Vite server that serves code in the browser. Does not affect [`test.api`](#api) option. By default, Vitest assigns port `63315` to avoid conflicts with the development server, allowing you to run both in parallel. - -#### browser.provider - -- **Type:** `'webdriverio' | 'playwright' | 'preview' | string` -- **Default:** `'preview'` -- **CLI:** `--browser.provider=playwright` - -Path to a provider that will be used when running browser tests. Vitest provides three providers which are `preview` (default), `webdriverio` and `playwright`. Custom providers should be exported using `default` export and have this shape: - -```ts -export interface BrowserProvider { - name: string - getSupportedBrowsers: () => readonly string[] - initialize: (ctx: Vitest, options: { browser: string; options?: BrowserProviderOptions }) => Awaitable - openPage: (url: string) => Awaitable - close: () => Awaitable -} -``` - -::: warning -This is an advanced API for library authors. If you just need to run tests in a browser, use the [browser](#browser) option. -::: - -#### browser.providerOptions {#browser-provideroptions} - -- **Type:** `BrowserProviderOptions` - -Options that will be passed down to provider when calling `provider.initialize`. - -```ts -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - browser: { - providerOptions: { - launch: { - devtools: true, - }, - }, - }, - }, -}) -``` - -::: tip -To have a better type safety when using built-in providers, you should reference one of these types (for provider that you are using) in your [config file](/config/): - -```ts -/// -/// -``` -::: - -#### browser.ui {#browser-ui} - -- **Type:** `boolean` -- **Default:** `!isCI` -- **CLI:** `--browser.ui=false` - -Should Vitest UI be injected into the page. By default, injects UI iframe during development. - -#### browser.viewport {#browser-viewport} - -- **Type:** `{ width, height }` -- **Default:** `414x896` - -Default iframe's viewport. - -#### browser.locators {#browser-locators} - -Options for built-in [browser locators](/guide/browser/locators). - -##### browser.locators.testIdAttribute - -- **Type:** `string` -- **Default:** `data-testid` - -Attribute used to find elements with `getByTestId` locator. - -#### browser.screenshotDirectory {#browser-screenshotdirectory} - -- **Type:** `string` -- **Default:** `__snapshots__` in the test file directory - -Path to the snapshots directory relative to the `root`. - -#### browser.screenshotFailures {#browser-screenshotfailures} - -- **Type:** `boolean` -- **Default:** `!browser.ui` - -Should Vitest take screenshots if the test fails. - -#### browser.orchestratorScripts {#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 -} -``` - -#### browser.testerScripts {#browser-testerscripts} - -- **Type:** `BrowserScript[]` -- **Default:** `[]` - -Custom scripts that should be injected into the tester HTML before the tests environment is initiated. This is useful to inject polyfills required for Vitest browser implementation. It is recommended to use [`setupFiles`](#setupfiles) in almost all cases instead of this. - -The script `src` and `content` will be processed by Vite plugins. - -#### browser.commands {#browser-commands} - -- **Type:** `Record` -- **Default:** `{ readFile, writeFile, ... }` - -Custom [commands](/guide/browser/commands) that can be imported during browser tests from `@vitest/browser/commands`. - ### clearMocks - **Type:** `boolean` diff --git a/docs/guide/browser/commands.md b/docs/guide/browser/commands.md index 419cd0b04e4a..d00232caa106 100644 --- a/docs/guide/browser/commands.md +++ b/docs/guide/browser/commands.md @@ -61,7 +61,7 @@ CDP session works only with `playwright` provider and only when using `chromium` ## Custom Commands -You can also add your own commands via [`browser.commands`](/config/#browser-commands) config option. If you develop a library, you can provide them via a `config` hook inside a plugin: +You can also add your own commands via [`browser.commands`](/guide/browser/config#browser-commands) config option. If you develop a library, you can provide them via a `config` hook inside a plugin: ```ts import type { Plugin } from 'vitest/config' diff --git a/docs/guide/browser/config.md b/docs/guide/browser/config.md new file mode 100644 index 000000000000..e71099de3667 --- /dev/null +++ b/docs/guide/browser/config.md @@ -0,0 +1,327 @@ +# Browser Config Reference + +You can change the browser configuration by updating the `test.browser` field in your [config file](/config/). An example of a simple config file: + +```ts [vitest.config.ts] +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + browser: { + enabled: true, + provider: 'playwright', + instances: [ + { + browser: 'chromium', + setupFile: './chromium-setup.js', + }, + ], + }, + }, +}) +``` + +Please, refer to the ["Config Reference"](/config/) article for different config examples. + +::: warning +_All listed options_ on this page are located within a `test` property inside the configuration: + +```ts [vitest.config.js] +export default defineConfig({ + test: { + browser: {}, + }, +}) +``` +::: + +## browser.enabled + +- **Type:** `boolean` +- **Default:** `false` +- **CLI:** `--browser`, `--browser.enabled=false` + +Run all tests inside a browser by default. Note that `--browser` only works if you have at least one [`browser.instances`](#browser-instances) item. + +## browser.instances + +- **Type:** `BrowserConfig` +- **Default:** `[{ browser: name }]` + +Defines multiple browser setups. Every config has to have at least a `browser` field. The config supports your providers configurations: + +- [Configuring Playwright](/guide/browser/playwright) +- [Configuring WebdriverIO](/guide/browser/webdriverio) + +::: tip +To have a better type safety when using built-in providers, you should reference one of these types (for provider that you are using) in your [config file](/config/): + +```ts +/// +/// +``` +::: + +In addition to that, you can also specify most of the [project options](/config/) (not marked with a icon) and some of the `browser` options like `browser.testerHtmlPath`. + +::: warning +Every browser config inherits options from the root config: + +```ts{3,9} [vitest.config.ts] +export default defineConfig({ + test: { + setupFile: ['./root-setup-file.js'], + browser: { + enabled: true, + testerHtmlPath: './custom-path.html', + instances: [ + { + // will have both setup files: "root" and "browser" + setupFile: ['./browser-setup-file.js'], + // implicitly has "testerHtmlPath" from the root config // [!code warning] + // testerHtmlPath: './custom-path.html', // [!code warning] + }, + ], + }, + }, +}) +``` + +During development, Vitest supports only one [non-headless](#browser-headless) configuration. You can limit the headed project yourself by specifying `headless: false` in the config, or by providing the `--browser.headless=false` flag, or by filtering projects with `--project=chromium` flag. + +For more examples, refer to the ["Multiple Setups" guide](/guide/browser/multiple-setups). +::: + +List of available `browser` options: + +- [`browser.headless`](#browser-headless) +- [`browser.locators`](#browser-locators) +- [`browser.viewport`](#browser-viewport) +- [`browser.testerHtmlPath`](#browser-testerhtmlpath) +- [`browser.screenshotDirectory`](#browser-screenshotdirectory) +- [`browser.screenshotFailures`](#browser-screenshotfailures) + +By default, Vitest creates an array with a single element which uses the [`browser.name`](#browser-name) field as a `browser`. Note that this behaviour will be removed with Vitets 4. + +Under the hood, Vitest transforms these instances into separate [test projects](/advanced/api/test-project) sharing a single Vite server for better caching performance. + +## browser.name deprecated {#browser-name} + +- **Type:** `string` +- **CLI:** `--browser=safari` + +::: danger +This API is deprecated an will be removed in Vitest 4. Please, use [`browser.instances`](#browser-instances) option instead. +::: + +Run all tests in a specific browser. Possible options in different providers: + +- `webdriverio`: `firefox`, `chrome`, `edge`, `safari` +- `playwright`: `firefox`, `webkit`, `chromium` +- custom: any string that will be passed to the provider + +## browser.headless + +- **Type:** `boolean` +- **Default:** `process.env.CI` +- **CLI:** `--browser.headless`, `--browser.headless=false` + +Run the browser in a `headless` mode. If you are running Vitest in CI, it will be enabled by default. + +## browser.isolate + +- **Type:** `boolean` +- **Default:** `true` +- **CLI:** `--browser.isolate`, `--browser.isolate=false` + +Run every test in a separate iframe. + +## browser.testerHtmlPath + +- **Type:** `string` + +A path to the HTML entry point. Can be relative to the root of the project. This file will be processed with [`transformIndexHtml`](https://vite.dev/guide/api-plugin#transformindexhtml) hook. + +## browser.api + +- **Type:** `number | { port?, strictPort?, host? }` +- **Default:** `63315` +- **CLI:** `--browser.api=63315`, `--browser.api.port=1234, --browser.api.host=example.com` + +Configure options for Vite server that serves code in the browser. Does not affect [`test.api`](#api) option. By default, Vitest assigns port `63315` to avoid conflicts with the development server, allowing you to run both in parallel. + +## browser.provider experimental {#browser-provider} + +- **Type:** `'webdriverio' | 'playwright' | 'preview' | string` +- **Default:** `'preview'` +- **CLI:** `--browser.provider=playwright` + +::: danger ADVANCED API +The provider API is highly experimental and can change between patches. If you just need to run tests in a browser, use the [`browser.instances`](#browser-instances) option instead. +::: + +Path to a provider that will be used when running browser tests. Vitest provides three providers which are `preview` (default), `webdriverio` and `playwright`. Custom providers should be exported using `default` export and have this shape: + +```ts +export interface BrowserProvider { + name: string + supportsParallelism: boolean + getSupportedBrowsers: () => readonly string[] + beforeCommand?: (command: string, args: unknown[]) => Awaitable + afterCommand?: (command: string, args: unknown[]) => Awaitable + getCommandsContext: (sessionId: string) => Record + openPage: (sessionId: string, url: string, beforeNavigate?: () => Promise) => Promise + getCDPSession?: (sessionId: string) => Promise + close: () => Awaitable + initialize( + ctx: TestProject, + options: BrowserProviderInitializationOptions + ): Awaitable +} +``` + +## browser.providerOptions deprecated {#browser-provideroptions} + +- **Type:** `BrowserProviderOptions` + +::: danger +This API is deprecated an will be removed in Vitest 4. Please, use [`browser.instances`](#browser-instances) option instead. +::: + +Options that will be passed down to provider when calling `provider.initialize`. + +```ts +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + browser: { + providerOptions: { + launch: { + devtools: true, + }, + }, + }, + }, +}) +``` + +::: tip +To have a better type safety when using built-in providers, you should reference one of these types (for provider that you are using) in your [config file](/config/): + +```ts +/// +/// +``` +::: + +## browser.ui + +- **Type:** `boolean` +- **Default:** `!isCI` +- **CLI:** `--browser.ui=false` + +Should Vitest UI be injected into the page. By default, injects UI iframe during development. + +## browser.viewport + +- **Type:** `{ width, height }` +- **Default:** `414x896` + +Default iframe's viewport. + +## browser.locators + +Options for built-in [browser locators](/guide/browser/locators). + +### browser.locators.testIdAttribute + +- **Type:** `string` +- **Default:** `data-testid` + +Attribute used to find elements with `getByTestId` locator. + +## browser.screenshotDirectory + +- **Type:** `string` +- **Default:** `__snapshots__` in the test file directory + +Path to the screenshots directory relative to the `root`. + +## browser.screenshotFailures + +- **Type:** `boolean` +- **Default:** `!browser.ui` + +Should Vitest take screenshots if the test fails. + +## 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 +} +``` + +## browser.testerScripts + +- **Type:** `BrowserScript[]` +- **Default:** `[]` + +::: danger +This API is deprecated an will be removed in Vitest 4. Please, use [`browser.testerHtmlPath`](#browser-testerHtmlPath) field instead. +::: + +Custom scripts that should be injected into the tester HTML before the tests environment is initiated. This is useful to inject polyfills required for Vitest browser implementation. It is recommended to use [`setupFiles`](#setupfiles) in almost all cases instead of this. + +The script `src` and `content` will be processed by Vite plugins. + +## browser.commands + +- **Type:** `Record` +- **Default:** `{ readFile, writeFile, ... }` + +Custom [commands](/guide/browser/commands) that can be imported during browser tests from `@vitest/browser/commands`. + +## browser.connectTimeout + +- **Type:** `number` +- **Default:** `60_000` + +The timeout in milliseconds. If connection to the browser takes longer, the test suite will fail. + +::: info +This is the time it should take for the browser to establish the WebSocket connection with the Vitest server. In normal circumstances, this timeout should never be reached. +::: diff --git a/docs/guide/browser/index.md b/docs/guide/browser/index.md index 4712eac69ec8..a9fa766d8e5e 100644 --- a/docs/guide/browser/index.md +++ b/docs/guide/browser/index.md @@ -95,7 +95,7 @@ bun add -D vitest @vitest/browser webdriverio ## Configuration -To activate browser mode in your Vitest configuration, you can use the `--browser` flag or set the `browser.enabled` field to `true` in your Vitest configuration file. Here is an example configuration using the browser field: +To activate browser mode in your Vitest configuration, you can use the `--browser=name` flag or set the `browser.enabled` field to `true` in your Vitest configuration file. Here is an example configuration using the browser field: ```ts [vitest.config.ts] import { defineConfig } from 'vitest/config' @@ -104,7 +104,10 @@ export default defineConfig({ browser: { provider: 'playwright', // or 'webdriverio' enabled: true, - name: 'chromium', // browser name is required + // at least one instance is required + instances: [ + { browser: 'chromium' }, + ], }, } }) @@ -129,7 +132,9 @@ export default defineConfig({ browser: { enabled: true, provider: 'playwright', - name: 'chromium', + instances: [ + { browser: 'chromium' }, + ], } } }) @@ -144,7 +149,9 @@ export default defineConfig({ browser: { enabled: true, provider: 'playwright', - name: 'chromium', + instances: [ + { browser: 'chromium' }, + ], } } }) @@ -159,7 +166,9 @@ export default defineConfig({ browser: { enabled: true, provider: 'playwright', - name: 'chromium', + instances: [ + { browser: 'chromium' }, + ], } } }) @@ -174,7 +183,9 @@ export default defineConfig({ browser: { enabled: true, provider: 'playwright', - name: 'chromium', + instances: [ + { browser: 'chromium' }, + ], } } }) @@ -189,7 +200,9 @@ export default defineConfig({ browser: { enabled: true, provider: 'playwright', - name: 'chromium', + instances: [ + { browser: 'chromium' }, + ], } } }) @@ -227,60 +240,15 @@ export default defineWorkspace([ name: 'browser', browser: { enabled: true, - name: 'chrome', + instances: [ + { browser: 'chromium' }, + ], }, }, }, ]) ``` -### Provider Configuration - -:::tabs key:provider -== Playwright -You can configure how Vitest [launches the browser](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) and creates the [page context](https://playwright.dev/docs/api/class-browsercontext) via [`providerOptions`](/config/#browser-provideroptions) field: - -```ts [vitest.config.ts] -export default defineConfig({ - test: { - browser: { - providerOptions: { - launch: { - devtools: true, - }, - context: { - geolocation: { - latitude: 45, - longitude: -30, - }, - reducedMotion: 'reduce', - }, - }, - }, - }, -}) -``` -== WebdriverIO -You can configure what [options](https://webdriver.io/docs/configuration#webdriverio) Vitest should use when starting a browser via [`providerOptions`](/config/#browser-provideroptions) field: - -```ts -export default defineConfig({ - test: { - browser: { - browser: 'chrome', - providerOptions: { - region: 'eu', - capabilities: { - browserVersion: '27.0', - platformName: 'Windows 10', - }, - }, - }, - }, -}) -``` -::: - ## Browser Option Types The browser option in Vitest depends on the provider. Vitest will fail, if you pass `--browser` and don't specify its name in the config file. Available options: @@ -361,7 +329,7 @@ npx vitest --browser=chrome Or you can provide browser options to CLI with dot notation: ```sh -npx vitest --browser.name=chrome --browser.headless +npx vitest --browser.headless ``` By default, Vitest will automatically open the browser UI for development. Your tests will run inside an iframe in the center. You can configure the viewport by selecting the preferred dimensions, calling `page.viewport` inside the test, or setting default values in [the config](/config/#browser-viewport). @@ -390,7 +358,7 @@ export default defineConfig({ You can also set headless mode using the `--browser.headless` flag in the CLI, like this: ```sh -npx vitest --browser.name=chrome --browser.headless +npx vitest --browser.headless ``` In this case, Vitest will run in headless mode using the Chrome browser. diff --git a/docs/guide/browser/locators.md b/docs/guide/browser/locators.md index be8ed5e5cf7e..f30b05ccdd80 100644 --- a/docs/guide/browser/locators.md +++ b/docs/guide/browser/locators.md @@ -364,7 +364,7 @@ page.getByTitle('Create') // ❌ function getByTestId(text: string | RegExp): Locator ``` -Creates a locator capable of finding an element that matches the specified test id attribute. You can configure the attribute name with [`browser.locators.testIdAttribute`](/config/#browser-locators-testidattribute). +Creates a locator capable of finding an element that matches the specified test id attribute. You can configure the attribute name with [`browser.locators.testIdAttribute`](/guide/browser/config#browser-locators-testidattribute). ```tsx
@@ -569,7 +569,7 @@ function screenshot(options?: LocatorScreenshotOptions & { base64?: false }): Pr Creates a screenshot of the element matching the locator's selector. -You can specify the save location for the screenshot using the `path` option, which is relative to the current test file. If the `path` option is not set, Vitest will default to using [`browser.screenshotDirectory`](/config/#browser-screenshotdirectory) (`__screenshot__` by default), along with the names of the file and the test to determine the screenshot's filepath. +You can specify the save location for the screenshot using the `path` option, which is relative to the current test file. If the `path` option is not set, Vitest will default to using [`browser.screenshotDirectory`](/guide/browser/config#browser-screenshotdirectory) (`__screenshot__` by default), along with the names of the file and the test to determine the screenshot's filepath. If you also need the content of the screenshot, you can specify `base64: true` to return it alongside the filepath where the screenshot is saved. diff --git a/docs/guide/browser/multiple-setups.md b/docs/guide/browser/multiple-setups.md new file mode 100644 index 000000000000..78bb6259c3e3 --- /dev/null +++ b/docs/guide/browser/multiple-setups.md @@ -0,0 +1,134 @@ +# Multiple Setups + +Since Vitest 3, you can specify several different browser setups using the new [`browser.instances`](/guide/browser/config#browser-instances) option. + +The main advatage of using the `browser.instances` over the [workspace](/guide/workspace) is improved caching. Every project will use the same Vite server meaning the file transform and [dependency pre-bundling](https://vite.dev/guide/dep-pre-bundling.html) has to happen only once. + +## Several Browsers + +You can use the `browser.instances` field to specify options for different browsers. For example, if you want to run the same tests in different browsers, the minimal configuration will look like this: + +```ts [vitest.config.ts] +import { defineConfig } from 'vitest/config' +export default defineConfig({ + test: { + browser: { + enabled: true, + provider: 'playwright', + headless: true, + instances: [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, + ], + }, + }, +}) +``` + +## Different Setups + +You can also specify different config options independently from the browser (although, the instances _can_ also have `browser` fields): + +::: code-group +```ts [vitest.config.ts] +import { defineConfig } from 'vitest/config' +export default defineConfig({ + test: { + browser: { + enabled: true, + provider: 'playwright', + headless: true, + instances: [ + { + browser: 'chromium', + name: 'chromium-1', + setupFiles: ['./ratio-setup.ts'], + provide: { + ratio: 1, + } + }, + { + browser: 'chromium', + name: 'chromium-2', + provide: { + ratio: 2, + } + }, + ], + }, + }, +}) +``` +```ts [example.test.ts] +import { expect, inject, test } from 'vitest' +import { globalSetupModifier } from './example.js' + +test('ratio works', () => { + expect(inject('ratio') * globalSetupModifier).toBe(14) +}) +``` +::: + +In this example Vitest will run all tests in `chromium` browser, but execute a `'./ratio-setup.ts'` file only in the first configuration and inject a different `ratio` value depending on the [`provide` field](/config/#provide). + +::: warning +Note that you need to define the custom `name` value if you are using the same browser name because Vitest will assign the `browser` as the project name otherwise. +::: + +## Filtering + +You can filter what projects to run with the [`--project` flag](/guide/cli#project). Vitest will automatically assign the browser name as a project name if it is not assigned manually. If the root config already has a name, Vitest will merge them: `custom` -> `custom (browser)`. + +```shell +$ vitest --project=chromium +``` + +::: code-group +```ts{6,8} [default] +export default defineConfig({ + test: { + browser: { + instances: [ + // name: chromium + { browser: 'chromium' }, + // name: custom + { browser: 'firefox', name: 'custom' }, + ] + } + } +}) +``` +```ts{3,7,9} [custom] +export default defineConfig({ + test: { + name: 'custom', + browser: { + instances: [ + // name: custom (chromium) + { browser: 'chromium' }, + // name: manual + { browser: 'firefox', name: 'manual' }, + ] + } + } +}) +``` +::: + +::: warning +Vitest cannot run multiple instances that have `headless` mode set to `false` (the default behaviour). During development, you can select what project to run in your terminal: + +```shell +? Found multiple projects that run browser tests in headed mode: "chromium", "firefox". +Vitest cannot run multiple headed browsers at the same time. Select a single project +to run or cancel and run tests with "headless: true" option. Note that you can also +start tests with --browser=name or --project=name flag. › - Use arrow-keys. Return to submit. +❯ chromium + firefox +``` + +If you have several non-headless projects in CI (i.e. the `headless: false` is set manually in the config and not overriden in CI env), Vitest will fail the run and won't start any tests. + +The ability to run tests in headless mode is not affected by this. You can still run all instances in parallel as long as they don't have `headless: false`. +::: diff --git a/docs/guide/browser/playwright.md b/docs/guide/browser/playwright.md new file mode 100644 index 000000000000..d143a2b4c759 --- /dev/null +++ b/docs/guide/browser/playwright.md @@ -0,0 +1,96 @@ +# Configuring Playwright + +By default, TypeScript doesn't recognize providers options and extra `expect` properties. Make sure to reference `@vitest/browser/providers/playwright` so TypeScript can pick up definitions for custom options: + +```ts [vitest.shims.d.ts] +/// +``` + +Alternatively, you can also add it to `compilerOptions.types` field in your `tsconfig.json` file. Note that specifying anything in this field will disable [auto loading](https://www.typescriptlang.org/tsconfig/#types) of `@types/*` packages. + +```json [tsconfig.json] +{ + "compilerOptions": { + "types": ["@vitest/browser/providers/playwright"] + } +} +``` + +Vitest opens a single page to run all tests in the same file. You can configure the `launch` and `context` properties in `instances`: + +```ts{9-10} [vitest.config.ts] +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + browser: { + instances: [ + { + browser: 'firefox', + launch: {}, + context: {}, + }, + ], + }, + }, +}) +``` + +::: warning +Before Vitest 3, these options were located on `test.browser.providerOptions` property: + +```ts [vitest.config.ts] +export default defineConfig({ + test: { + browser: { + providerOptions: { + launch: {}, + context: {}, + }, + }, + }, +}) +``` + +`providerOptions` is deprecated in favour of `instances`. +::: + +## launch + +These options are directly passed down to `playwright[browser].launch` command. You can read more about the command and available arguments in the [Playwright documentation](https://playwright.dev/docs/api/class-browsertype#browser-type-launch). + +::: warning +Vitest will ignore `launch.headless` option. Instead, use [`test.browser.headless`](/guide/browser/config#browser-headless). + +Note that Vitest will push debugging flags to `launch.args` if [`--inspect`](/guide/cli#inspect) is enabled. +::: + +## context + +Vitest creates a new context for every test file by calling [`browser.newContext()`](https://playwright.dev/docs/api/class-browsercontext). You can configure this behaviour by specifying [custom arguments](https://playwright.dev/docs/api/class-apirequest#api-request-new-context). + +::: tip +Note that the context is created for every _test file_, not every _test_ like in playwright test runner. +::: + +::: warning +Vitest awlays sets `ignoreHTTPSErrors` to `true` in case your server is served via HTTPS and `serviceWorkers` to `'allow'` to support module mocking via [MSW](https://mswjs.io). + +It is also recommended to use [`test.browser.viewport`](/guide/browser/config#browser-headless) instead of specifying it here as it will be lost when tests are running in headless mode. +::: + +## `actionTimeout` 3.0.0 + +- **Default:** no timeout, 1 second before 3.0.0 + +This value configures the default timeout it takes for Playwright to wait until all accessibility checks pass and [the action](/guide/browser/interactivity-api) is actually done. + +You can also configure the action timeout per-action: + +```ts +import { page, userEvent } from '@vitest/browser/context' + +await userEvent.click(page.getByRole('button'), { + timeout: 1_000, +}) +``` diff --git a/docs/guide/browser/webdriverio.md b/docs/guide/browser/webdriverio.md new file mode 100644 index 000000000000..b0afdf789713 --- /dev/null +++ b/docs/guide/browser/webdriverio.md @@ -0,0 +1,69 @@ +# Configuring WebdriverIO + +::: info Playwright vs WebdriverIO +If you do not already use WebdriverIO in your project, we recommend starting with [Playwright](/guide/browser/playwright) as it is easier to configure and has more flexible API. +::: + +By default, TypeScript doesn't recognize providers options and extra `expect` properties. Make sure to reference `@vitest/browser/providers/webdriverio` so TypeScript can pick up definitions for custom options: + +```ts [vitest.shims.d.ts] +/// +``` + +Alternatively, you can also add it to `compilerOptions.types` field in your `tsconfig.json` file. Note that specifying anything in this field will disable [auto loading](https://www.typescriptlang.org/tsconfig/#types) of `@types/*` packages. + +```json [tsconfig.json] +{ + "compilerOptions": { + "types": ["@vitest/browser/providers/webdriverio"] + } +} +``` + +Vitest opens a single page to run all tests in the same file. You can configure any property specified in `RemoteOptions` in `instances`: + +```ts{9-12} [vitest.config.ts] +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + browser: { + instances: [ + { + browser: 'chrome', + capabilities: { + browserVersion: 86, + platformName: 'Windows 10', + }, + }, + ], + }, + }, +}) +``` + +::: warning +Before Vitest 3, these options were located on `test.browser.providerOptions` property: + +```ts [vitest.config.ts] +export default defineConfig({ + test: { + browser: { + providerOptions: { + capabilities: {}, + }, + }, + }, +}) +``` + +`providerOptions` is deprecated in favour of `instances`. +::: + +You can find most available options in the [WebdriverIO documentation](https://webdriver.io/docs/configuration/). Note that Vitest will ignore all test runner options because we only use `webdriverio`'s browser capabilities. + +::: tip +Most useful options are located on `capabilities` object. WebdriverIO allows nested capabilities, but Vitest will ignore those options because we rely on a different mechanism to spawn several browsers. + +Note that Vitest will ignore `capabilities.browserName`. Use [`test.browser.instances.name`](/guide/browser/config#browser-capabilities-name) instead. +::: diff --git a/docs/guide/cli-generated.md b/docs/guide/cli-generated.md index 9acbdfb0421d..3a0dc829b266 100644 --- a/docs/guide/cli-generated.md +++ b/docs/guide/cli-generated.md @@ -316,77 +316,77 @@ Mock browser API with happy-dom ### browser.enabled - **CLI:** `--browser.enabled` -- **Config:** [browser.enabled](/config/#browser-enabled) +- **Config:** [browser.enabled](/guide/browser/config#browser-enabled) Run tests in the browser. Equivalent to `--browser.enabled` (default: `false`) ### browser.name - **CLI:** `--browser.name ` -- **Config:** [browser.name](/config/#browser-name) +- **Config:** [browser.name](/guide/browser/config#browser-name) -Run all tests in a specific browser. Some browsers are only available for specific providers (see `--browser.provider`). Visit [`browser.name`](https://vitest.dev/config/#browser-name) for more information +Run all tests in a specific browser. Some browsers are only available for specific providers (see `--browser.provider`). Visit [`browser.name`](https://vitest.dev/guide/browser/config/#browser-name) for more information ### browser.headless - **CLI:** `--browser.headless` -- **Config:** [browser.headless](/config/#browser-headless) +- **Config:** [browser.headless](/guide/browser/config#browser-headless) Run the browser in headless mode (i.e. without opening the GUI (Graphical User Interface)). If you are running Vitest in CI, it will be enabled by default (default: `process.env.CI`) ### browser.api.port - **CLI:** `--browser.api.port [port]` -- **Config:** [browser.api.port](/config/#browser-api-port) +- **Config:** [browser.api.port](/guide/browser/config#browser-api-port) Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to `63315` ### browser.api.host - **CLI:** `--browser.api.host [host]` -- **Config:** [browser.api.host](/config/#browser-api-host) +- **Config:** [browser.api.host](/guide/browser/config#browser-api-host) Specify which IP addresses the server should listen on. Set this to `0.0.0.0` or `true` to listen on all addresses, including LAN and public addresses ### browser.api.strictPort - **CLI:** `--browser.api.strictPort` -- **Config:** [browser.api.strictPort](/config/#browser-api-strictport) +- **Config:** [browser.api.strictPort](/guide/browser/config#browser-api-strictport) Set to true to exit if port is already in use, instead of automatically trying the next available port ### browser.provider - **CLI:** `--browser.provider ` -- **Config:** [browser.provider](/config/#browser-provider) +- **Config:** [browser.provider](/guide/browser/config#browser-provider) Provider used to run browser tests. Some browsers are only available for specific providers. Can be "webdriverio", "playwright", "preview", or the path to a custom provider. Visit [`browser.provider`](https://vitest.dev/config/#browser-provider) for more information (default: `"preview"`) ### browser.providerOptions - **CLI:** `--browser.providerOptions ` -- **Config:** [browser.providerOptions](/config/#browser-provideroptions) +- **Config:** [browser.providerOptions](/guide/browser/config#browser-provideroptions) Options that are passed down to a browser provider. Visit [`browser.providerOptions`](https://vitest.dev/config/#browser-provideroptions) for more information ### browser.isolate - **CLI:** `--browser.isolate` -- **Config:** [browser.isolate](/config/#browser-isolate) +- **Config:** [browser.isolate](/guide/browser/config#browser-isolate) Run every browser test file in isolation. To disable isolation, use `--browser.isolate=false` (default: `true`) ### browser.ui - **CLI:** `--browser.ui` -- **Config:** [browser.ui](/config/#browser-ui) +- **Config:** [browser.ui](/guide/browser/config#browser-ui) Show Vitest UI when running tests (default: `!process.env.CI`) ### browser.fileParallelism - **CLI:** `--browser.fileParallelism` -- **Config:** [browser.fileParallelism](/config/#browser-fileparallelism) +- **Config:** [browser.fileParallelism](/guide/browser/config#browser-fileparallelism) Should browser test files run in parallel. Use `--browser.fileParallelism=false` to disable (default: `true`) diff --git a/docs/guide/migration.md b/docs/guide/migration.md index cfed94061c6e..d57569fd7c98 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -29,6 +29,31 @@ test('validation works', () => { }, 1000) // Ok ✅ ``` +### `browser.name` and `browser.providerOptions` are Deprecated + +Both [`browser.name`](/guide/browser/config#browser-name) and [`browser.providerOptions`](/guide/browser/config#browser-provideroptions) will be removed in Vitest 4. Instead of them, use the new [`browser.instances`](/guide/browser/config#browser-instances) option: + +```ts +export default defineConfig({ + test: { + browser: { + name: 'chromium', // [!code --] + providerOptions: { // [!code --] + launch: { devtools: true }, // [!code --] + }, // [!code --] + instances: [ // [!code ++] + { // [!code ++] + browser: 'chromium', // [!code ++] + launch: { devtools: true }, // [!code ++] + }, // [!code ++] + ], // [!code ++] + }, + }, +}) +``` + +With the new `browser.instances` field you can also specify multiple browser configurations. + ### `Custom` Type is Deprecated API {#custom-type-is-deprecated} The `Custom` type is now an alias for the `Test` type. Note that Vitest updated the public types in 2.1 and changed exported names to `RunnerCustomCase` and `RunnerTestCase`: diff --git a/docs/package.json b/docs/package.json index a77a7a57632d..4d33e6b7591d 100644 --- a/docs/package.json +++ b/docs/package.json @@ -18,18 +18,18 @@ "vue": "^3.5.12" }, "devDependencies": { - "@iconify-json/carbon": "^1.2.4", - "@iconify-json/logos": "^1.2.3", - "@shikijs/transformers": "^1.24.2", - "@shikijs/vitepress-twoslash": "^1.24.2", - "@unocss/reset": "^0.65.1", + "@iconify-json/carbon": "^1.2.5", + "@iconify-json/logos": "^1.2.4", + "@shikijs/transformers": "^1.24.3", + "@shikijs/vitepress-twoslash": "^1.24.3", + "@unocss/reset": "^0.65.2", "@vite-pwa/assets-generator": "^0.2.6", "@vite-pwa/vitepress": "^0.5.3", "@vitejs/plugin-vue": "^5.2.1", "https-localhost": "^4.7.1", "tinyglobby": "^0.2.10", - "unocss": "^0.65.1", - "unplugin-vue-components": "^0.27.5", + "unocss": "^0.65.2", + "unplugin-vue-components": "^0.28.0", "vite": "^5.2.8", "vite-plugin-pwa": "^0.21.1", "vitepress": "^1.5.0", diff --git a/eslint.config.js b/eslint.config.js index 2b17354694d6..1bccb592d1ec 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -79,7 +79,7 @@ export default antfu( 'no-restricted-imports': [ 'error', { - paths: ['vitest', 'path'], + paths: ['vitest', 'path', 'vitest/node'], }, ], }, diff --git a/package.json b/package.json index 4f4ed7150ee6..4094410accaf 100644 --- a/package.json +++ b/package.json @@ -38,21 +38,21 @@ "devDependencies": { "@antfu/eslint-config": "^3.11.2", "@antfu/ni": "^0.23.1", - "@playwright/test": "^1.49.0", - "@rollup/plugin-commonjs": "^28.0.1", + "@playwright/test": "^1.49.1", + "@rollup/plugin-commonjs": "^28.0.2", "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.3.0", - "@types/node": "^22.10.1", + "@rollup/plugin-node-resolve": "^15.3.1", + "@types/node": "^22.10.2", "@types/ws": "^8.5.13", "@vitest/browser": "workspace:*", "@vitest/coverage-istanbul": "workspace:*", "@vitest/coverage-v8": "workspace:*", "@vitest/ui": "workspace:*", - "bumpp": "^9.9.0", + "bumpp": "^9.9.1", "changelogithub": "^0.13.11", "esbuild": "^0.24.0", "eslint": "^9.16.0", - "magic-string": "^0.30.14", + "magic-string": "^0.30.17", "pathe": "^1.1.2", "rimraf": "^6.0.1", "rollup": "^4.28.1", diff --git a/packages/browser/package.json b/packages/browser/package.json index a96bb1cac9d8..15efc0de4128 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -91,8 +91,8 @@ "@testing-library/user-event": "^14.5.2", "@vitest/mocker": "workspace:*", "@vitest/utils": "workspace:*", - "magic-string": "^0.30.14", - "msw": "^2.6.8", + "magic-string": "^0.30.17", + "msw": "^2.7.0", "sirv": "^3.0.0", "tinyrainbow": "^1.2.0", "ws": "^8.18.0" @@ -107,13 +107,13 @@ "birpc": "0.2.19", "flatted": "^3.3.2", "ivya": "^1.1.1", - "mime": "^4.0.4", + "mime": "^4.0.6", "pathe": "^1.1.2", "periscopic": "^4.0.2", - "playwright": "^1.49.0", - "playwright-core": "^1.49.0", + "playwright": "^1.49.1", + "playwright-core": "^1.49.1", "safaridriver": "^1.0.0", "vitest": "workspace:*", - "webdriverio": "^8.40.6" + "webdriverio": "^8.41.0" } } diff --git a/packages/browser/providers/webdriverio.d.ts b/packages/browser/providers/webdriverio.d.ts index 3675cd995b47..1c4a2b75bfdb 100644 --- a/packages/browser/providers/webdriverio.d.ts +++ b/packages/browser/providers/webdriverio.d.ts @@ -2,7 +2,7 @@ import type { RemoteOptions, ClickOptions, DragAndDropOptions } from 'webdriveri import '../matchers.js' declare module 'vitest/node' { - interface BrowserProviderOptions extends RemoteOptions {} + interface BrowserProviderOptions extends Partial {} export interface UserEventClickOptions extends ClickOptions {} diff --git a/packages/browser/src/client/channel.ts b/packages/browser/src/client/channel.ts index b1aaa1964475..4a69579e2852 100644 --- a/packages/browser/src/client/channel.ts +++ b/packages/browser/src/client/channel.ts @@ -41,7 +41,7 @@ export type IframeChannelEvent = | IframeChannelOutgoingEvent export const channel = new BroadcastChannel( - `vitest:${getBrowserState().contextId}`, + `vitest:${getBrowserState().sessionId}`, ) export const globalChannel = new BroadcastChannel('vitest:global') diff --git a/packages/browser/src/client/client.ts b/packages/browser/src/client/client.ts index fd4e8c48a50b..b6fa768adcb1 100644 --- a/packages/browser/src/client/client.ts +++ b/packages/browser/src/client/client.ts @@ -8,13 +8,13 @@ const PAGE_TYPE = getBrowserState().type export const PORT = location.port export const HOST = [location.hostname, PORT].filter(Boolean).join(':') -export const SESSION_ID +export const RPC_ID = PAGE_TYPE === 'orchestrator' - ? getBrowserState().contextId + ? getBrowserState().sessionId : getBrowserState().testerId export const ENTRY_URL = `${ location.protocol === 'https:' ? 'wss:' : 'ws:' -}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&sessionId=${SESSION_ID}` +}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&rpcId=${RPC_ID}&sessionId=${getBrowserState().sessionId}&projectName=${getBrowserState().config.name || ''}` let setCancel = (_: CancelReason) => {} export const onCancel = new Promise((resolve) => { diff --git a/packages/browser/src/client/orchestrator.ts b/packages/browser/src/client/orchestrator.ts index fc576692bd3c..4450ed22213c 100644 --- a/packages/browser/src/client/orchestrator.ts +++ b/packages/browser/src/client/orchestrator.ts @@ -14,9 +14,7 @@ class IframeOrchestrator { private runningFiles = new Set() private iframes = new Map() - public async init() { - const testFiles = getBrowserState().files - + public async init(testFiles: string[]) { debug('test files', testFiles.join(', ')) this.runningFiles.clear() @@ -38,6 +36,7 @@ class IframeOrchestrator { testFiles.forEach(file => this.runningFiles.add(file)) const config = getConfig() + debug('create testers', testFiles.join(', ')) const container = await getContainer(config) if (config.browser.ui) { @@ -51,6 +50,7 @@ class IframeOrchestrator { this.iframes.clear() if (config.isolate === false) { + debug('create iframe', ID_ALL) const iframe = this.createIframe(container, ID_ALL) await setIframeViewport(iframe, width, height) @@ -63,6 +63,7 @@ class IframeOrchestrator { return } + debug('create iframe', file) const iframe = this.createIframe(container, file) await setIframeViewport(iframe, width, height) @@ -93,7 +94,7 @@ class IframeOrchestrator { iframe.setAttribute( 'src', `${url.pathname}__vitest_test__/__test__/${ - getBrowserState().contextId + getBrowserState().sessionId }/${encodeURIComponent(file)}`, ) iframe.setAttribute('data-vitest', 'true') @@ -212,7 +213,7 @@ getBrowserState().createTesters = async (files) => { } async function done() { - await client.rpc.finishBrowserTests(getBrowserState().contextId) + await client.rpc.finishBrowserTests(getBrowserState().sessionId) } async function getContainer(config: SerializedConfig): Promise { @@ -233,7 +234,7 @@ async function getContainer(config: SerializedConfig): Promise { client.waitForConnection().then(async () => { const testFiles = getBrowserState().files - await orchestrator.init() + await orchestrator.init(testFiles) // if page was refreshed, there will be no test files // createTesters will be called again when tests are running in the UI diff --git a/packages/browser/src/client/public/esm-client-injector.js b/packages/browser/src/client/public/esm-client-injector.js index fe4fef717e92..a3eae26951bb 100644 --- a/packages/browser/src/client/public/esm-client-injector.js +++ b/packages/browser/src/client/public/esm-client-injector.js @@ -24,7 +24,7 @@ viteConfig: { __VITEST_VITE_CONFIG__ }, files: { __VITEST_FILES__ }, type: { __VITEST_TYPE__ }, - contextId: { __VITEST_CONTEXT_ID__ }, + sessionId: { __VITEST_SESSION_ID__ }, testerId: { __VITEST_TESTER_ID__ }, provider: { __VITEST_PROVIDER__ }, providedContext: { __VITEST_PROVIDED_CONTEXT__ }, diff --git a/packages/browser/src/client/tester/context.ts b/packages/browser/src/client/tester/context.ts index 433b5b1220c1..ee408be8c0d1 100644 --- a/packages/browser/src/client/tester/context.ts +++ b/packages/browser/src/client/tester/context.ts @@ -22,11 +22,11 @@ function filepath() { return getWorkerState().filepath || getWorkerState().current?.file?.filepath || undefined } const rpc = () => getWorkerState().rpc as any as BrowserRPC -const contextId = getBrowserState().contextId -const channel = new BroadcastChannel(`vitest:${contextId}`) +const sessionId = getBrowserState().sessionId +const channel = new BroadcastChannel(`vitest:${sessionId}`) function triggerCommand(command: string, ...args: any[]) { - return rpc().triggerCommand(contextId, command, filepath(), args) + return rpc().triggerCommand(sessionId, command, filepath(), args) } export function createUserEvent(__tl_user_event_base__?: TestingLibraryUserEvent, options?: TestingLibraryOptions): UserEvent { diff --git a/packages/browser/src/client/tester/locators/index.ts b/packages/browser/src/client/tester/locators/index.ts index 665ff43d616b..0ae190d02e17 100644 --- a/packages/browser/src/client/tester/locators/index.ts +++ b/packages/browser/src/client/tester/locators/index.ts @@ -211,7 +211,7 @@ export abstract class Locator { || undefined return ensureAwaited(() => this.rpc.triggerCommand( - this.state.contextId, + this.state.sessionId, command, filepath, args, diff --git a/packages/browser/src/client/tester/runner.ts b/packages/browser/src/client/tester/runner.ts index 40ff4501b2c5..df6ba60e3178 100644 --- a/packages/browser/src/client/tester/runner.ts +++ b/packages/browser/src/client/tester/runner.ts @@ -61,8 +61,13 @@ export function createBrowserRunner( } onTaskFinished = async (task: Task) => { - if (this.config.browser.screenshotFailures && task.result?.state === 'fail') { - task.meta.failScreenshotPath = await page.screenshot() + if (this.config.browser.screenshotFailures && document.body.clientHeight > 0 && task.result?.state === 'fail') { + const screenshot = await page.screenshot().catch((err) => { + console.error('[vitest] Failed to take a screenshot', err) + }) + if (screenshot) { + task.meta.failScreenshotPath = screenshot + } } } @@ -104,6 +109,10 @@ export function createBrowserRunner( } } + onCollectStart = (file: File) => { + return rpc().onQueued(file) + } + onCollected = async (files: File[]): Promise => { files.forEach((file) => { file.prepareDuration = state.durations.prepare diff --git a/packages/browser/src/client/tester/state.ts b/packages/browser/src/client/tester/state.ts index 2c7591a75ac5..a1698446dbf8 100644 --- a/packages/browser/src/client/tester/state.ts +++ b/packages/browser/src/client/tester/state.ts @@ -4,7 +4,7 @@ import { parse } from 'flatted' import { getBrowserState } from '../utils' const config = getBrowserState().config -const contextId = getBrowserState().contextId +const sessionId = getBrowserState().sessionId const providedContext = parse(getBrowserState().providedContext) @@ -65,13 +65,13 @@ function createCdp() { const cdp = { send(method: string, params?: Record) { - return rpc().sendCdpEvent(contextId, method, params) + return rpc().sendCdpEvent(sessionId, method, params) }, on(event: string, listener: (payload: any) => void) { const listenerId = getId(listener) listeners[event] = listeners[event] || [] listeners[event].push(listener) - rpc().trackCdpEvent(contextId, 'on', event, listenerId).catch(error) + rpc().trackCdpEvent(sessionId, 'on', event, listenerId).catch(error) return cdp }, once(event: string, listener: (payload: any) => void) { @@ -82,7 +82,7 @@ function createCdp() { } listeners[event] = listeners[event] || [] listeners[event].push(handler) - rpc().trackCdpEvent(contextId, 'once', event, listenerId).catch(error) + rpc().trackCdpEvent(sessionId, 'once', event, listenerId).catch(error) return cdp }, off(event: string, listener: (payload: any) => void) { @@ -90,7 +90,7 @@ function createCdp() { if (listeners[event]) { listeners[event] = listeners[event].filter(l => l !== listener) } - rpc().trackCdpEvent(contextId, 'off', event, listenerId).catch(error) + rpc().trackCdpEvent(sessionId, 'off', event, listenerId).catch(error) return cdp }, emit(event: string, payload: unknown) { diff --git a/packages/browser/src/client/utils.ts b/packages/browser/src/client/utils.ts index 147b7c3dc344..1eba8160656c 100644 --- a/packages/browser/src/client/utils.ts +++ b/packages/browser/src/client/utils.ts @@ -72,7 +72,7 @@ export interface BrowserRunnerState { type: 'tester' | 'orchestrator' wrapModule: (module: () => T) => T iframeId?: string - contextId: string + sessionId: string testerId: string runTests?: (tests: string[]) => Promise createTesters?: (files: string[]) => Promise diff --git a/packages/browser/src/node/commands/keyboard.ts b/packages/browser/src/node/commands/keyboard.ts index c0be014d0804..4413260f5636 100644 --- a/packages/browser/src/node/commands/keyboard.ts +++ b/packages/browser/src/node/commands/keyboard.ts @@ -27,7 +27,7 @@ export const keyboard: UserEventCommand<(text: string, state: KeyboardState) => await keyboardImplementation( pressed, context.provider, - context.contextId, + context.sessionId, text, async () => { if (context.provider instanceof PlaywrightBrowserProvider) { @@ -53,9 +53,9 @@ export const keyboardCleanup: UserEventCommand<(state: KeyboardState) => Promise context, state, ) => { - const { provider, contextId } = context + const { provider, sessionId } = context if (provider instanceof PlaywrightBrowserProvider) { - const page = provider.getPage(contextId) + const page = provider.getPage(sessionId) for (const key of state.unreleased) { await page.keyboard.up(key) } @@ -79,13 +79,13 @@ const VALID_KEYS = new Set(['Escape', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', export async function keyboardImplementation( pressed: Set, provider: BrowserProvider, - contextId: string, + sessionId: string, text: string, selectAll: () => Promise, skipRelease: boolean, ) { if (provider instanceof PlaywrightBrowserProvider) { - const page = provider.getPage(contextId) + const page = provider.getPage(sessionId) const actions = parseKeyDef(defaultKeyMap, text) for (const { releasePrevious, releaseSelf, repeat, keyDef } of actions) { diff --git a/packages/browser/src/node/commands/type.ts b/packages/browser/src/node/commands/type.ts index a330c2bd313b..0e38734d5da7 100644 --- a/packages/browser/src/node/commands/type.ts +++ b/packages/browser/src/node/commands/type.ts @@ -24,7 +24,7 @@ export const type: UserEventCommand = async ( await keyboardImplementation( unreleased, context.provider, - context.contextId, + context.sessionId, text, () => element.selectText(), skipAutoClose, @@ -41,7 +41,7 @@ export const type: UserEventCommand = async ( await keyboardImplementation( unreleased, context.provider, - context.contextId, + context.sessionId, text, () => browser.execute(() => { const element = document.activeElement as HTMLInputElement diff --git a/packages/browser/src/node/index.ts b/packages/browser/src/node/index.ts index c7af212b3c98..fd1143f65254 100644 --- a/packages/browser/src/node/index.ts +++ b/packages/browser/src/node/index.ts @@ -4,13 +4,13 @@ import c from 'tinyrainbow' import { createViteLogger, createViteServer } from 'vitest/node' import { version } from '../../package.json' import BrowserPlugin from './plugin' +import { ParentBrowserProject } from './projectParent' import { setupBrowserRpc } from './rpc' -import { BrowserServer } from './server' export { distRoot } from './constants' export { createBrowserPool } from './pool' -export type { BrowserServer } from './server' +export type { ProjectBrowser } from './project' export async function createBrowserServer( project: TestProject, @@ -18,23 +18,23 @@ export async function createBrowserServer( prePlugins: Plugin[] = [], postPlugins: Plugin[] = [], ) { - if (project.ctx.version !== version) { - project.ctx.logger.warn( + if (project.vitest.version !== version) { + project.vitest.logger.warn( c.yellow( - `Loaded ${c.inverse(c.yellow(` vitest@${project.ctx.version} `))} and ${c.inverse(c.yellow(` @vitest/browser@${version} `))}.` + `Loaded ${c.inverse(c.yellow(` vitest@${project.vitest.version} `))} and ${c.inverse(c.yellow(` @vitest/browser@${version} `))}.` + '\nRunning mixed versions is not supported and may lead into bugs' + '\nUpdate your dependencies and make sure the versions match.', ), ) } - const server = new BrowserServer(project, '/') + const server = new ParentBrowserProject(project, '/') const configPath = typeof configFile === 'string' ? configFile : false const logLevel = (process.env.VITEST_BROWSER_DEBUG as 'info') ?? 'info' - const logger = createViteLogger(project.logger, logLevel, { + const logger = createViteLogger(project.vitest.logger, logLevel, { allowClearScreen: false, }) diff --git a/packages/browser/src/node/middlewares/orchestratorMiddleware.ts b/packages/browser/src/node/middlewares/orchestratorMiddleware.ts new file mode 100644 index 000000000000..c6d5d8848a8d --- /dev/null +++ b/packages/browser/src/node/middlewares/orchestratorMiddleware.ts @@ -0,0 +1,25 @@ +import type { Connect } from 'vite' +import type { ParentBrowserProject } from '../projectParent' +import { resolveOrchestrator } from '../serverOrchestrator' +import { allowIframes, disableCache } from './utils' + +export function createOrchestratorMiddleware(parentServer: ParentBrowserProject): Connect.NextHandleFunction { + return async function vitestOrchestratorMiddleware(req, res, next) { + if (!req.url) { + return next() + } + const url = new URL(req.url, 'http://localhost') + if (url.pathname !== parentServer.base) { + return next() + } + + const html = await resolveOrchestrator(parentServer, url, res) + if (html) { + disableCache(res) + allowIframes(res) + + res.write(html, 'utf-8') + res.end() + } + } +} diff --git a/packages/browser/src/node/middlewares/testerMiddleware.ts b/packages/browser/src/node/middlewares/testerMiddleware.ts new file mode 100644 index 000000000000..435ff7149ed1 --- /dev/null +++ b/packages/browser/src/node/middlewares/testerMiddleware.ts @@ -0,0 +1,24 @@ +import type { Connect } from 'vite' +import type { ParentBrowserProject } from '../projectParent' +import { resolveTester } from '../serverTester' +import { allowIframes, disableCache } from './utils' + +export function createTesterMiddleware(browserServer: ParentBrowserProject): Connect.NextHandleFunction { + return async function vitestTesterMiddleware(req, res, next) { + if (!req.url) { + return next() + } + const url = new URL(req.url, 'http://localhost') + if (!url.pathname.startsWith(browserServer.prefixTesterUrl)) { + return next() + } + + const html = await resolveTester(browserServer, url, res, next) + if (html) { + disableCache(res) + allowIframes(res) + res.write(html, 'utf-8') + res.end() + } + } +} diff --git a/packages/browser/src/node/middlewares/utils.ts b/packages/browser/src/node/middlewares/utils.ts new file mode 100644 index 000000000000..0d27a8e1fb64 --- /dev/null +++ b/packages/browser/src/node/middlewares/utils.ts @@ -0,0 +1,14 @@ +import type { ServerResponse } from 'node:http' + +export function disableCache(res: ServerResponse) { + res.setHeader( + 'Cache-Control', + 'no-cache, max-age=0, must-revalidate', + ) + res.setHeader('Content-Type', 'text/html; charset=utf-8') +} + +export function allowIframes(res: ServerResponse) { + // remove custom iframe related headers to allow the iframe to load + res.removeHeader('X-Frame-Options') +} diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index 2d6c85d9bb1f..73f43899d760 100644 --- a/packages/browser/src/node/plugin.ts +++ b/packages/browser/src/node/plugin.ts @@ -1,7 +1,7 @@ import type { Stats } from 'node:fs' import type { HtmlTagDescriptor } from 'vite' -import type { TestProject } from 'vitest/node' -import type { BrowserServer } from './server' +import type { Vitest } from 'vitest/node' +import type { ParentBrowserProject } from './projectParent' import { lstatSync, readFileSync } from 'node:fs' import { createRequire } from 'node:module' import { dynamicImportPlugin } from '@vitest/mocker/node' @@ -12,20 +12,18 @@ import sirv from 'sirv' import { coverageConfigDefaults, type Plugin } from 'vitest/config' import { getFilePoolName, resolveApiServerConfig, resolveFsAllow, distDir as vitestDist } from 'vitest/node' import { distRoot } from './constants' +import { createOrchestratorMiddleware } from './middlewares/orchestratorMiddleware' +import { createTesterMiddleware } from './middlewares/testerMiddleware' import BrowserContext from './plugins/pluginContext' -import { resolveOrchestrator } from './serverOrchestrator' -import { resolveTester } from './serverTester' export { defineBrowserCommand } from './commands/utils' export type { BrowserCommand } from 'vitest/node' const versionRegexp = /(?:\?|&)v=\w{8}/ -export default (browserServer: BrowserServer, base = '/'): Plugin[] => { - const project = browserServer.project - +export default (parentServer: ParentBrowserProject, base = '/'): Plugin[] => { function isPackageExists(pkg: string, root: string) { - return browserServer.project.ctx.packageInstaller.isPackageExists?.(pkg, { + return parentServer.vitest.packageInstaller.isPackageExists?.(pkg, { paths: [root], }) } @@ -35,7 +33,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { enforce: 'pre', name: 'vitest:browser', async configureServer(server) { - browserServer.setServer(server) + parentServer.setServer(server) // eslint-disable-next-line prefer-arrow-callback server.middlewares.use(function vitestHeaders(_req, res, next) { @@ -47,38 +45,8 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { } next() }) - // eslint-disable-next-line prefer-arrow-callback - server.middlewares.use(async function vitestBrowserMode(req, res, next) { - if (!req.url || !browserServer.provider) { - return next() - } - const url = new URL(req.url, 'http://localhost') - if (!url.pathname.startsWith(browserServer.prefixTesterUrl) && url.pathname !== base) { - return next() - } - - res.setHeader( - 'Cache-Control', - 'no-cache, max-age=0, must-revalidate', - ) - res.setHeader('Content-Type', 'text/html; charset=utf-8') - - // remove custom iframe related headers to allow the iframe to load - res.removeHeader('X-Frame-Options') - - if (url.pathname === base) { - const html = await resolveOrchestrator(browserServer, url, res) - res.write(html, 'utf-8') - res.end() - return - } - - const html = await resolveTester(browserServer, url, res, next) - if (html) { - res.write(html, 'utf-8') - res.end() - } - }) + server.middlewares.use(createOrchestratorMiddleware(parentServer)) + server.middlewares.use(createTesterMiddleware(parentServer)) server.middlewares.use( `${base}favicon.svg`, @@ -89,7 +57,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { }, ) - const coverageFolder = resolveCoverageFolder(project) + const coverageFolder = resolveCoverageFolder(parentServer.vitest) const coveragePath = coverageFolder ? coverageFolder[1] : undefined if (coveragePath && base === coveragePath) { throw new Error( @@ -113,12 +81,12 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { ) } - const screenshotFailures = project.config.browser.ui && project.config.browser.screenshotFailures + const uiEnabled = parentServer.config.browser.ui - if (screenshotFailures) { + if (uiEnabled) { // eslint-disable-next-line prefer-arrow-callback server.middlewares.use(`${base}__screenshot-error`, function vitestBrowserScreenshotError(req, res) { - if (!req.url || !browserServer.provider) { + if (!req.url) { res.statusCode = 404 res.end() return @@ -184,6 +152,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { name: 'vitest:browser:tests', enforce: 'pre', async config() { + const project = parentServer.vitest.getProjectByName(parentServer.config.name) const { testFiles: allTestFiles } = await project.globTestFiles() const browserTestFiles = allTestFiles.filter( file => getFilePoolName(project, file) === 'browser', @@ -234,18 +203,18 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { entries.push(project.config.diff) } - if (project.ctx.coverageProvider) { - const coverage = project.ctx.config.coverage + if (parentServer.vitest.coverageProvider) { + const coverage = parentServer.vitest.config.coverage const provider = coverage.provider if (provider === 'v8') { - const path = tryResolve('@vitest/coverage-v8', [project.config.root]) + const path = tryResolve('@vitest/coverage-v8', [parentServer.config.root]) if (path) { entries.push(path) exclude.push('@vitest/coverage-v8/browser') } } else if (provider === 'istanbul') { - const path = tryResolve('@vitest/coverage-istanbul', [project.config.root]) + const path = tryResolve('@vitest/coverage-istanbul', [parentServer.config.root]) if (path) { entries.push(path) exclude.push('@vitest/coverage-istanbul') @@ -333,14 +302,14 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { } }, transform(code, id) { - if (id.includes(browserServer.vite.config.cacheDir) && id.includes('loupe.js')) { + if (id.includes(parentServer.vite.config.cacheDir) && id.includes('loupe.js')) { // loupe bundle has a nastry require('util') call that leaves a warning in the console const utilRequire = 'nodeUtil = require_util();' return code.replace(utilRequire, ' '.repeat(utilRequire.length)) } }, }, - BrowserContext(browserServer), + BrowserContext(parentServer), dynamicImportPlugin({ globalThisAccessor: '"__vitest_browser_runner__"', filter(id) { @@ -360,7 +329,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { viteConfig.esbuild.legalComments = 'inline' } - const defaultPort = project.ctx._browserLastPort++ + const defaultPort = parentServer.vitest._browserLastPort++ const api = resolveApiServerConfig( viteConfig.test?.browser || {}, @@ -378,8 +347,8 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { viteConfig.server.fs.allow = viteConfig.server.fs.allow || [] viteConfig.server.fs.allow.push( ...resolveFsAllow( - project.ctx.config.root, - project.ctx.server.config.configFile, + parentServer.vitest.config.root, + parentServer.vitest.vite.config.configFile, ), distRoot, ) @@ -394,6 +363,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { { name: 'vitest:browser:in-source-tests', transform(code, id) { + const project = parentServer.vitest.getProjectByName(parentServer.config.name) if (!project.isCachedTestFile(id) || !code.includes('import.meta.vitest')) { return } @@ -425,26 +395,30 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { name: 'vitest:browser:transform-tester-html', enforce: 'pre', async transformIndexHtml(html, ctx) { - if (ctx.filename !== browserServer.testerFilepath) { + const projectBrowser = [...parentServer.children].find((server) => { + return ctx.filename === server.testerFilepath + }) + if (!projectBrowser) { return } - if (!browserServer.testerScripts) { - const testerScripts = await browserServer.formatScripts( - project.config.browser.testerScripts, + if (!parentServer.testerScripts) { + const testerScripts = await parentServer.formatScripts( + parentServer.config.browser.testerScripts, ) - browserServer.testerScripts = testerScripts + parentServer.testerScripts = testerScripts } - const stateJs = typeof browserServer.stateJs === 'string' - ? browserServer.stateJs - : await browserServer.stateJs + const stateJs = typeof parentServer.stateJs === 'string' + ? parentServer.stateJs + : await parentServer.stateJs const testerTags: HtmlTagDescriptor[] = [] - const isDefaultTemplate = resolve(distRoot, 'client/tester/tester.html') === browserServer.testerFilepath + + const isDefaultTemplate = resolve(distRoot, 'client/tester/tester.html') === projectBrowser.testerFilepath if (!isDefaultTemplate) { - const manifestContent = browserServer.manifest instanceof Promise - ? await browserServer.manifest - : browserServer.manifest + const manifestContent = parentServer.manifest instanceof Promise + ? await parentServer.manifest + : parentServer.manifest const testerEntry = manifestContent['tester/tester.html'] testerTags.push({ @@ -452,7 +426,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { attrs: { type: 'module', crossorigin: '', - src: `${browserServer.base}${testerEntry.file}`, + src: `${parentServer.base}${testerEntry.file}`, }, injectTo: 'head', }) @@ -464,7 +438,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { { tag: 'link', attrs: { - href: `${browserServer.base}${entryManifest.file}`, + href: `${parentServer.base}${entryManifest.file}`, rel: 'modulepreload', crossorigin: '', }, @@ -508,21 +482,21 @@ body { tag: 'script', attrs: { type: 'module', - src: browserServer.errorCatcherUrl, + src: parentServer.errorCatcherUrl, }, injectTo: 'head' as const, }, - browserServer.locatorsUrl + parentServer.locatorsUrl ? { tag: 'script', attrs: { type: 'module', - src: browserServer.locatorsUrl, + src: parentServer.locatorsUrl, }, injectTo: 'head', } as const : null, - ...browserServer.testerScripts, + ...parentServer.testerScripts, ...testerTags, { tag: 'script', @@ -583,8 +557,8 @@ function getRequire() { return _require } -function resolveCoverageFolder(project: TestProject) { - const options = project.ctx.config +function resolveCoverageFolder(vitest: Vitest) { + const options = vitest.config const htmlReporter = options.coverage?.enabled ? toArray(options.coverage.reporter).find((reporter) => { if (typeof reporter === 'string') { diff --git a/packages/browser/src/node/plugins/pluginContext.ts b/packages/browser/src/node/plugins/pluginContext.ts index 54c193d74b67..5929822ae557 100644 --- a/packages/browser/src/node/plugins/pluginContext.ts +++ b/packages/browser/src/node/plugins/pluginContext.ts @@ -1,33 +1,16 @@ import type { PluginContext } from 'rollup' import type { Plugin } from 'vitest/config' -import type { BrowserProvider } from 'vitest/node' -import type { BrowserServer } from '../server' +import type { ParentBrowserProject } from '../projectParent' import { fileURLToPath } from 'node:url' import { slash } from '@vitest/utils' import { dirname, resolve } from 'pathe' -import builtinCommands from '../commands/index' const VIRTUAL_ID_CONTEXT = '\0@vitest/browser/context' const ID_CONTEXT = '@vitest/browser/context' const __dirname = dirname(fileURLToPath(import.meta.url)) -export default function BrowserContext(server: BrowserServer): Plugin { - const project = server.project - project.config.browser.commands ??= {} - for (const [name, command] of Object.entries(builtinCommands)) { - project.config.browser.commands[name] ??= command - } - - // validate names because they can't be used as identifiers - for (const command in project.config.browser.commands) { - if (!/^[a-z_$][\w$]*$/i.test(command)) { - throw new Error( - `Invalid command name "${command}". Only alphanumeric characters, $ and _ are allowed.`, - ) - } - } - +export default function BrowserContext(globalServer: ParentBrowserProject): Plugin { return { name: 'vitest:browser:virtual-module:context', enforce: 'pre', @@ -38,7 +21,7 @@ export default function BrowserContext(server: BrowserServer): Plugin { }, load(id) { if (id === VIRTUAL_ID_CONTEXT) { - return generateContextFile.call(this, server) + return generateContextFile.call(this, globalServer) } }, } @@ -46,22 +29,23 @@ export default function BrowserContext(server: BrowserServer): Plugin { async function generateContextFile( this: PluginContext, - server: BrowserServer, + globalServer: ParentBrowserProject, ) { - const commands = Object.keys(server.project.config.browser.commands ?? {}) + const commands = Object.keys(globalServer.commands) const filepathCode = '__vitest_worker__.filepath || __vitest_worker__.current?.file?.filepath || undefined' - const provider = server.provider + const provider = [...globalServer.children][0].provider || { name: 'preview' } + const providerName = provider.name const commandsCode = commands .filter(command => !command.startsWith('__vitest')) .map((command) => { - return ` ["${command}"]: (...args) => rpc().triggerCommand(contextId, "${command}", filepath(), args),` + return ` ["${command}"]: (...args) => rpc().triggerCommand(sessionId, "${command}", filepath(), args),` }) .join('\n') const userEventNonProviderImport = await getUserEventImport( - provider, + providerName, this.resolve.bind(this), ) const distContextPath = slash(`/@fs/${resolve(__dirname, 'context.js')}`) @@ -71,13 +55,13 @@ import { page, createUserEvent, cdp } from '${distContextPath}' ${userEventNonProviderImport} const filepath = () => ${filepathCode} const rpc = () => __vitest_worker__.rpc -const contextId = __vitest_browser_runner__.contextId +const sessionId = __vitest_browser_runner__.sessionId export const server = { platform: ${JSON.stringify(process.platform)}, version: ${JSON.stringify(process.version)}, - provider: ${JSON.stringify(provider.name)}, - browser: ${JSON.stringify(server.project.config.browser.name)}, + provider: ${JSON.stringify(providerName)}, + browser: __vitest_browser_runner__.config.browser.name, commands: { ${commandsCode} }, @@ -89,8 +73,8 @@ export { page, cdp } ` } -async function getUserEventImport(provider: BrowserProvider, resolve: (id: string, importer: string) => Promise) { - if (provider.name !== 'preview') { +async function getUserEventImport(provider: string, resolve: (id: string, importer: string) => Promise) { + if (provider !== 'preview') { return 'const _userEventSetup = undefined' } const resolved = await resolve('@testing-library/user-event', __dirname) diff --git a/packages/browser/src/node/pool.ts b/packages/browser/src/node/pool.ts index aef0f4ef9d01..22cb41377a60 100644 --- a/packages/browser/src/node/pool.ts +++ b/packages/browser/src/node/pool.ts @@ -8,19 +8,19 @@ const debug = createDebugger('vitest:browser:pool') async function waitForTests( method: 'run' | 'collect', - contextId: string, + sessionId: string, project: TestProject, files: string[], ) { - const context = project.browser!.state.createAsyncContext(method, contextId, files) + const context = project.vitest._browserSessions.createAsyncSession(method, sessionId, files, project) return await context } -export function createBrowserPool(ctx: Vitest): ProcessPool { +export function createBrowserPool(vitest: Vitest): ProcessPool { const providers = new Set() const executeTests = async (method: 'run' | 'collect', project: TestProject, files: string[]) => { - ctx.state.clearFiles(project, files) + vitest.state.clearFiles(project, files) const browser = project.browser! const threadsCount = getThreadsCount(project) @@ -37,7 +37,7 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { ) } - async function setBreakpoint(contextId: string, file: string) { + async function setBreakpoint(sessionId: string, file: string) { if (!project.config.inspector.waitForDebugger) { return } @@ -46,7 +46,7 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { throw new Error('Unable to set breakpoint, CDP not supported') } - const session = await provider.getCDPSession(contextId) + const session = await provider.getCDPSession(sessionId) await session.send('Debugger.enable', {}) await session.send('Debugger.setBreakpointByUrl', { lineNumber: 0, @@ -79,13 +79,13 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { chunks.forEach((files, index) => { if (orchestrators[index]) { - const [contextId, orchestrator] = orchestrators[index] + const [sessionId, orchestrator] = orchestrators[index] debug?.( - 'Reusing orchestrator (context %s) for files: %s', - contextId, + 'Reusing orchestrator (session %s) for files: %s', + sessionId, [...files.map(f => relative(project.config.root, f))].join(', '), ) - const promise = waitForTests(method, contextId, project, files) + const promise = waitForTests(method, sessionId, project, files) const tester = orchestrator.createTesters(files).catch((error) => { if (error instanceof Error && error.message.startsWith('[birpc] rpc is closed')) { return @@ -95,17 +95,17 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { promises.push(promise, tester) } else { - const contextId = crypto.randomUUID() - const waitPromise = waitForTests(method, contextId, project, files) + const sessionId = crypto.randomUUID() + const waitPromise = waitForTests(method, sessionId, project, files) debug?.( - 'Opening a new context %s for files: %s', - contextId, + 'Opening a new session %s for files: %s', + sessionId, [...files.map(f => relative(project.config.root, f))].join(', '), ) const url = new URL('/', origin) - url.searchParams.set('contextId', contextId) + url.searchParams.set('sessionId', sessionId) const page = provider - .openPage(contextId, url.toString(), () => setBreakpoint(contextId, files[0])) + .openPage(sessionId, url.toString(), () => setBreakpoint(sessionId, files[0])) promises.push(page, waitPromise) } }) @@ -122,7 +122,7 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { } let isCancelled = false - ctx.onCancel(() => { + vitest.onCancel(() => { isCancelled = true }) @@ -152,7 +152,7 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { return 1 } - return ctx.config.watch + return vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1) } @@ -162,7 +162,7 @@ export function createBrowserPool(ctx: Vitest): ProcessPool { async close() { await Promise.all([...providers].map(provider => provider.close())) providers.clear() - ctx.resolvedProjects.forEach((project) => { + vitest.resolvedProjects.forEach((project) => { project.browser?.state.orchestrators.forEach((orchestrator) => { orchestrator.$close() }) diff --git a/packages/browser/src/node/project.ts b/packages/browser/src/node/project.ts new file mode 100644 index 000000000000..f528c6ee25e9 --- /dev/null +++ b/packages/browser/src/node/project.ts @@ -0,0 +1,122 @@ +import type { StackTraceParserOptions } from '@vitest/utils/source-map' +import type { ErrorWithDiff, SerializedConfig } from 'vitest' +import type { + BrowserProvider, + ProjectBrowser as IProjectBrowser, + ResolvedConfig, + TestProject, + Vitest, +} from 'vitest/node' +import type { ParentBrowserProject } from './projectParent' +import { existsSync } from 'node:fs' +import { readFile } from 'node:fs/promises' +import { fileURLToPath } from 'node:url' +import { resolve } from 'pathe' +import { BrowserServerState } from './state' +import { getBrowserProvider } from './utils' + +export class ProjectBrowser implements IProjectBrowser { + public testerHtml: Promise | string + public testerFilepath: string + public locatorsUrl: string | undefined + + public provider!: BrowserProvider + public vitest: Vitest + public config: ResolvedConfig + public children = new Set() + + public parent!: ParentBrowserProject + + public state = new BrowserServerState() + + constructor( + public project: TestProject, + public base: string, + ) { + this.vitest = project.vitest + this.config = project.config + + const pkgRoot = resolve(fileURLToPath(import.meta.url), '../..') + const distRoot = resolve(pkgRoot, 'dist') + + const testerHtmlPath = project.config.browser.testerHtmlPath + ? resolve(project.config.root, project.config.browser.testerHtmlPath) + : resolve(distRoot, 'client/tester/tester.html') + if (!existsSync(testerHtmlPath)) { + throw new Error(`Tester HTML file "${testerHtmlPath}" doesn't exist.`) + } + this.testerFilepath = testerHtmlPath + + this.testerHtml = readFile( + testerHtmlPath, + 'utf8', + ).then(html => (this.testerHtml = html)) + } + + get vite() { + return this.parent.vite + } + + wrapSerializedConfig() { + const config = wrapConfig(this.project.serializedConfig) + config.env ??= {} + config.env.VITEST_BROWSER_DEBUG = process.env.VITEST_BROWSER_DEBUG || '' + return config + } + + async initBrowserProvider(project: TestProject) { + if (this.provider) { + return + } + const Provider = await getBrowserProvider(project.config.browser, project) + this.provider = new Provider() + const browser = project.config.browser.name + const name = project.name ? `[${project.name}] ` : '' + if (!browser) { + throw new Error( + `${name}Browser name is required. Please, set \`test.browser.instances[].browser\` option manually.`, + ) + } + const supportedBrowsers = this.provider.getSupportedBrowsers() + if (supportedBrowsers.length && !supportedBrowsers.includes(browser)) { + throw new Error( + `${name}Browser "${browser}" is not supported by the browser provider "${ + this.provider.name + }". Supported browsers: ${supportedBrowsers.join(', ')}.`, + ) + } + const providerOptions = project.config.browser.providerOptions + await this.provider.initialize(project, { + browser, + options: providerOptions, + }) + } + + public parseErrorStacktrace( + e: ErrorWithDiff, + options: StackTraceParserOptions = {}, + ) { + return this.parent.parseErrorStacktrace(e, options) + } + + public parseStacktrace( + trace: string, + options: StackTraceParserOptions = {}, + ) { + return this.parent.parseStacktrace(trace, options) + } + + async close() { + await this.parent.vite.close() + } +} + +function wrapConfig(config: SerializedConfig): SerializedConfig { + return { + ...config, + // workaround RegExp serialization + testNamePattern: config.testNamePattern + ? (config.testNamePattern.toString() as any as RegExp) + : undefined, + } +} diff --git a/packages/browser/src/node/server.ts b/packages/browser/src/node/projectParent.ts similarity index 56% rename from packages/browser/src/node/server.ts rename to packages/browser/src/node/projectParent.ts index 56dfbde9f7d6..9e90a954f78b 100644 --- a/packages/browser/src/node/server.ts +++ b/packages/browser/src/node/projectParent.ts @@ -1,50 +1,52 @@ import type { HtmlTagDescriptor } from 'vite' -import type { ErrorWithDiff, SerializedConfig } from 'vitest' +import type { ErrorWithDiff, ParsedStack } from 'vitest' import type { - BrowserProvider, + BrowserCommand, BrowserScript, CDPSession, - BrowserServer as IBrowserServer, + ResolvedConfig, TestProject, Vite, + Vitest, } from 'vitest/node' -import { existsSync } from 'node:fs' +import type { BrowserServerState } from './state' import { readFile } from 'node:fs/promises' -import { fileURLToPath } from 'node:url' -import { slash } from '@vitest/utils' import { parseErrorStacktrace, parseStacktrace, type StackTraceParserOptions } from '@vitest/utils/source-map' import { join, resolve } from 'pathe' import { BrowserServerCDPHandler } from './cdp' -import { BrowserServerState } from './state' -import { getBrowserProvider } from './utils' - -export class BrowserServer implements IBrowserServer { - public faviconUrl: string - public prefixTesterUrl: string +import builtinCommands from './commands/index' +import { distRoot } from './constants' +import { ProjectBrowser } from './project' +import { slash } from './utils' +export class ParentBrowserProject { public orchestratorScripts: string | undefined public testerScripts: HtmlTagDescriptor[] | undefined + public faviconUrl: string + public prefixTesterUrl: string public manifest: Promise | Vite.Manifest - public testerHtml: Promise | string - public testerFilepath: string + + public vite!: Vite.ViteDevServer + private stackTraceOptions: StackTraceParserOptions public orchestratorHtml: Promise | string public injectorJs: Promise | string public errorCatcherUrl: string public locatorsUrl: string | undefined public stateJs: Promise | string - public state: BrowserServerState - public provider!: BrowserProvider - - public vite!: Vite.ViteDevServer + public commands: Record> = {} + public children = new Set() + public vitest: Vitest - private stackTraceOptions: StackTraceParserOptions + public config: ResolvedConfig constructor( public project: TestProject, public base: string, ) { + this.vitest = project.vitest + this.config = project.config this.stackTraceOptions = { frameFilter: project.config.onStackTrace, getSourceMap: (id) => { @@ -64,10 +66,19 @@ export class BrowserServer implements IBrowserServer { }, } - this.state = new BrowserServerState() + for (const [name, command] of Object.entries(builtinCommands)) { + this.commands[name] ??= command + } - const pkgRoot = resolve(fileURLToPath(import.meta.url), '../..') - const distRoot = resolve(pkgRoot, 'dist') + // validate names because they can't be used as identifiers + for (const command in project.config.browser.commands) { + if (!/^[a-z_$][\w$]*$/i.test(command)) { + throw new Error( + `Invalid command name "${command}". Only alphanumeric characters, $ and _ are allowed.`, + ) + } + this.commands[command] = project.config.browser.commands[command] + } this.prefixTesterUrl = `${base}__vitest_test__/__test__/` this.faviconUrl = `${base}__vitest__/favicon.svg` @@ -78,18 +89,6 @@ export class BrowserServer implements IBrowserServer { ) })().then(manifest => (this.manifest = manifest)) - const testerHtmlPath = project.config.browser.testerHtmlPath - ? resolve(project.config.root, project.config.browser.testerHtmlPath) - : resolve(distRoot, 'client/tester/tester.html') - if (!existsSync(testerHtmlPath)) { - throw new Error(`Tester HTML file "${testerHtmlPath}" doesn't exist.`) - } - this.testerFilepath = testerHtmlPath - - this.testerHtml = readFile( - testerHtmlPath, - 'utf8', - ).then(html => (this.testerHtml = html)) this.orchestratorHtml = (project.config.browser.ui ? readFile(resolve(distRoot, 'client/__vitest__/index.html'), 'utf8') : readFile(resolve(distRoot, 'client/orchestrator.html'), 'utf8')) @@ -111,91 +110,27 @@ export class BrowserServer implements IBrowserServer { ).then(js => (this.stateJs = js)) } - setServer(server: Vite.ViteDevServer) { - this.vite = server - } - - getSerializableConfig() { - const config = wrapConfig(this.project.getSerializableConfig()) - config.env ??= {} - config.env.VITEST_BROWSER_DEBUG = process.env.VITEST_BROWSER_DEBUG || '' - return config - } - - resolveTesterUrl(pathname: string) { - const [contextId, testFile] = pathname - .slice(this.prefixTesterUrl.length) - .split('/') - const decodedTestFile = decodeURIComponent(testFile) - return { contextId, testFile: decodedTestFile } + public setServer(vite: Vite.ViteDevServer) { + this.vite = vite } - async formatScripts( - scripts: BrowserScript[] | undefined, - ) { - if (!scripts?.length) { - return [] + public spawn(project: TestProject): ProjectBrowser { + if (!this.vite) { + throw new Error(`Cannot spawn child server without a parent dev server.`) } - const server = this.vite - const promises = scripts.map( - async ({ content, src, async, id, type = 'module' }, index): Promise => { - const srcLink = (src ? (await server.pluginContainer.resolveId(src))?.id : undefined) || src - const transformId = srcLink || join(server.config.root, `virtual__${id || `injected-${index}.js`}`) - await server.moduleGraph.ensureEntryFromUrl(transformId) - const contentProcessed - = content && type === 'module' - ? (await server.pluginContainer.transform(content, transformId)).code - : content - return { - tag: 'script', - attrs: { - type, - ...(async ? { async: '' } : {}), - ...(srcLink - ? { - src: srcLink.startsWith('http') ? srcLink : slash(`/@fs/${srcLink}`), - } - : {}), - }, - injectTo: 'head', - children: contentProcessed || '', - } - }, + const clone = new ProjectBrowser( + project, + '/', ) - return (await Promise.all(promises)) - } - - async initBrowserProvider() { - if (this.provider) { - return - } - const Provider = await getBrowserProvider(this.project.config.browser, this.project) - this.provider = new Provider() - const browser = this.project.config.browser.name - if (!browser) { - throw new Error( - `[${this.project.name}] Browser name is required. Please, set \`test.browser.name\` option manually.`, - ) - } - const supportedBrowsers = this.provider.getSupportedBrowsers() - if (supportedBrowsers.length && !supportedBrowsers.includes(browser)) { - throw new Error( - `[${this.project.name}] Browser "${browser}" is not supported by the browser provider "${ - this.provider.name - }". Supported browsers: ${supportedBrowsers.join(', ')}.`, - ) - } - const providerOptions = this.project.config.browser.providerOptions - await this.provider.initialize(this.project, { - browser, - options: providerOptions, - }) + clone.parent = this + this.children.add(clone) + return clone } public parseErrorStacktrace( e: ErrorWithDiff, options: StackTraceParserOptions = {}, - ) { + ): ParsedStack[] { return parseErrorStacktrace(e, { ...this.stackTraceOptions, ...options, @@ -205,59 +140,99 @@ export class BrowserServer implements IBrowserServer { public parseStacktrace( trace: string, options: StackTraceParserOptions = {}, - ) { + ): ParsedStack[] { return parseStacktrace(trace, { ...this.stackTraceOptions, ...options, }) } + public readonly cdps = new Map() private cdpSessionsPromises = new Map>() - async ensureCDPHandler(contextId: string, sessionId: string) { - const cachedHandler = this.state.cdps.get(sessionId) + async ensureCDPHandler(sessionId: string, rpcId: string) { + const cachedHandler = this.cdps.get(rpcId) if (cachedHandler) { return cachedHandler } + const browserSession = this.vitest._browserSessions.getSession(sessionId) + if (!browserSession) { + throw new Error(`Session "${sessionId}" not found.`) + } - const provider = this.provider + const browser = browserSession.project.browser! + const provider = browser.provider + if (!provider) { + throw new Error(`Browser provider is not defined for the project "${browserSession.project.name}".`) + } if (!provider.getCDPSession) { throw new Error(`CDP is not supported by the provider "${provider.name}".`) } - const promise = this.cdpSessionsPromises.get(sessionId) ?? await (async () => { - const promise = provider.getCDPSession!(contextId).finally(() => { - this.cdpSessionsPromises.delete(sessionId) + const promise = this.cdpSessionsPromises.get(rpcId) ?? await (async () => { + const promise = provider.getCDPSession!(sessionId).finally(() => { + this.cdpSessionsPromises.delete(rpcId) }) - this.cdpSessionsPromises.set(sessionId, promise) + this.cdpSessionsPromises.set(rpcId, promise) return promise })() const session = await promise - const rpc = this.state.testers.get(sessionId) + const rpc = (browser.state as BrowserServerState).testers.get(rpcId) if (!rpc) { - throw new Error(`Tester RPC "${sessionId}" was not established.`) + throw new Error(`Tester RPC "${rpcId}" was not established.`) } const handler = new BrowserServerCDPHandler(session, rpc) - this.state.cdps.set( - sessionId, + this.cdps.set( + rpcId, handler, ) return handler } - async close() { - await this.vite.close() + removeCDPHandler(sessionId: string) { + this.cdps.delete(sessionId) + } + + async formatScripts(scripts: BrowserScript[] | undefined) { + if (!scripts?.length) { + return [] + } + const server = this.vite + const promises = scripts.map( + async ({ content, src, async, id, type = 'module' }, index): Promise => { + const srcLink = (src ? (await server.pluginContainer.resolveId(src))?.id : undefined) || src + const transformId = srcLink || join(server.config.root, `virtual__${id || `injected-${index}.js`}`) + await server.moduleGraph.ensureEntryFromUrl(transformId) + const contentProcessed + = content && type === 'module' + ? (await server.pluginContainer.transform(content, transformId)).code + : content + return { + tag: 'script', + attrs: { + type, + ...(async ? { async: '' } : {}), + ...(srcLink + ? { + src: srcLink.startsWith('http') ? srcLink : slash(`/@fs/${srcLink}`), + } + : {}), + }, + injectTo: 'head', + children: contentProcessed || '', + } + }, + ) + return (await Promise.all(promises)) } -} -function wrapConfig(config: SerializedConfig): SerializedConfig { - return { - ...config, - // workaround RegExp serialization - testNamePattern: config.testNamePattern - ? (config.testNamePattern.toString() as any as RegExp) - : undefined, + resolveTesterUrl(pathname: string) { + const [sessionId, testFile] = pathname + .slice(this.prefixTesterUrl.length) + .split('/') + const decodedTestFile = decodeURIComponent(testFile) + return { sessionId, testFile: decodedTestFile } } } diff --git a/packages/browser/src/node/providers/playwright.ts b/packages/browser/src/node/providers/playwright.ts index f01e3cf37f3e..2a08cef23695 100644 --- a/packages/browser/src/node/providers/playwright.ts +++ b/packages/browser/src/node/providers/playwright.ts @@ -80,7 +80,7 @@ export class PlaywrightBrowserProvider implements BrowserProvider { launchOptions.args.push(`--remote-debugging-port=${port}`) launchOptions.args.push(`--remote-debugging-address=${host}`) - this.project.logger.log(`Debugger listening on ws://${host}:${port}`) + this.project.vitest.logger.log(`Debugger listening on ws://${host}:${port}`) } // start Vitest UI maximized only on supported browsers @@ -102,9 +102,9 @@ export class PlaywrightBrowserProvider implements BrowserProvider { return this.browserPromise } - private async createContext(contextId: string) { - if (this.contexts.has(contextId)) { - return this.contexts.get(contextId)! + private async createContext(sessionId: string) { + if (this.contexts.has(sessionId)) { + return this.contexts.get(sessionId)! } const browser = await this.openBrowser() @@ -121,23 +121,23 @@ export class PlaywrightBrowserProvider implements BrowserProvider { if (actionTimeout) { context.setDefaultTimeout(actionTimeout) } - this.contexts.set(contextId, context) + this.contexts.set(sessionId, context) return context } - public getPage(contextId: string) { - const page = this.pages.get(contextId) + public getPage(sessionId: string) { + const page = this.pages.get(sessionId) if (!page) { - throw new Error(`Page "${contextId}" not found`) + throw new Error(`Page "${sessionId}" not found in ${this.browserName} browser.`) } return page } - public getCommandsContext(contextId: string) { - const page = this.getPage(contextId) + public getCommandsContext(sessionId: string) { + const page = this.getPage(sessionId) return { page, - context: this.contexts.get(contextId)!, + context: this.contexts.get(sessionId)!, frame() { return new Promise((resolve, reject) => { const frame = page.frame('vitest-iframe') @@ -161,16 +161,16 @@ export class PlaywrightBrowserProvider implements BrowserProvider { } } - private async openBrowserPage(contextId: string) { - if (this.pages.has(contextId)) { - const page = this.pages.get(contextId)! + private async openBrowserPage(sessionId: string) { + if (this.pages.has(sessionId)) { + const page = this.pages.get(sessionId)! await page.close() - this.pages.delete(contextId) + this.pages.delete(sessionId) } - const context = await this.createContext(contextId) + const context = await this.createContext(sessionId) const page = await context.newPage() - this.pages.set(contextId, page) + this.pages.set(sessionId, page) if (process.env.VITEST_PW_DEBUG) { page.on('requestfailed', (request) => { @@ -188,14 +188,14 @@ export class PlaywrightBrowserProvider implements BrowserProvider { return page } - async openPage(contextId: string, url: string, beforeNavigate?: () => Promise) { - const browserPage = await this.openBrowserPage(contextId) + async openPage(sessionId: string, url: string, beforeNavigate?: () => Promise) { + const browserPage = await this.openBrowserPage(sessionId) await beforeNavigate?.() await browserPage.goto(url, { timeout: 0 }) } - async getCDPSession(contextId: string) { - const page = this.getPage(contextId) + async getCDPSession(sessionid: string) { + const page = this.getPage(sessionid) const cdp = await page.context().newCDPSession(page) return { async send(method: string, params: any) { diff --git a/packages/browser/src/node/providers/preview.ts b/packages/browser/src/node/providers/preview.ts index 2a495996d469..3df60c36a6c5 100644 --- a/packages/browser/src/node/providers/preview.ts +++ b/packages/browser/src/node/providers/preview.ts @@ -27,10 +27,10 @@ export class PreviewBrowserProvider implements BrowserProvider { 'You\'ve enabled headless mode for "preview" provider but it doesn\'t support it. Use "playwright" or "webdriverio" instead: https://vitest.dev/guide/browser/#configuration', ) } - project.ctx.logger.printBrowserBanner(project) + project.vitest.logger.printBrowserBanner(project) } - async openPage(_contextId: string, url: string) { + async openPage(_sessionId: string, url: string) { this.open = true if (!this.project.browser) { throw new Error('Browser is not initialized') diff --git a/packages/browser/src/node/providers/webdriver.ts b/packages/browser/src/node/providers/webdriver.ts index c28584f42b1b..fe80067e39f3 100644 --- a/packages/browser/src/node/providers/webdriver.ts +++ b/packages/browser/src/node/providers/webdriver.ts @@ -120,7 +120,7 @@ export class WebdriverBrowserProvider implements BrowserProvider { return capabilities } - async openPage(_contextId: string, url: string) { + async openPage(_sessionId: string, url: string) { const browserInstance = await this.openBrowser() await browserInstance.url(url) } diff --git a/packages/browser/src/node/rpc.ts b/packages/browser/src/node/rpc.ts index 0147438cddb9..45c4a5b22c3a 100644 --- a/packages/browser/src/node/rpc.ts +++ b/packages/browser/src/node/rpc.ts @@ -1,7 +1,9 @@ +import type { Duplex } from 'node:stream' import type { ErrorWithDiff } from 'vitest' -import type { BrowserCommandContext, ResolveSnapshotPathHandlerContext } from 'vitest/node' +import type { BrowserCommandContext, ResolveSnapshotPathHandlerContext, TestModule, TestProject } from 'vitest/node' import type { WebSocket } from 'ws' -import type { BrowserServer } from './server' +import type { ParentBrowserProject } from './projectParent' +import type { BrowserServerState } from './state' import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from './types' import { existsSync, promises as fs } from 'node:fs' import { ServerMockResolver } from '@vitest/mocker/node' @@ -15,14 +17,13 @@ const debug = createDebugger('vitest:browser:api') const BROWSER_API_PATH = '/__vitest_browser_api__' -export function setupBrowserRpc(server: BrowserServer) { - const project = server.project - const vite = server.vite - const ctx = project.ctx +export function setupBrowserRpc(globalServer: ParentBrowserProject) { + const vite = globalServer.vite + const vitest = globalServer.vitest const wss = new WebSocketServer({ noServer: true }) - vite.httpServer?.on('upgrade', (request, socket, head) => { + vite.httpServer?.on('upgrade', (request, socket: Duplex, head: Buffer) => { if (!request.url) { return } @@ -32,27 +33,61 @@ export function setupBrowserRpc(server: BrowserServer) { return } - const type = searchParams.get('type') ?? 'tester' - const sessionId = searchParams.get('sessionId') ?? '0' + const type = searchParams.get('type') + const rpcId = searchParams.get('rpcId') + const sessionId = searchParams.get('sessionId') + const projectName = searchParams.get('projectName') + + if (type !== 'tester' && type !== 'orchestrator') { + return error( + new Error(`[vitest] Type query in ${request.url} is invalid. Type should be either "tester" or "orchestrator".`), + ) + } + + if (!sessionId || !rpcId || projectName == null) { + return error( + new Error(`[vitest] Invalid URL ${request.url}. "projectName", "sessionId" and "rpcId" queries are required.`), + ) + } + + if (type === 'orchestrator') { + const session = vitest._browserSessions.getSession(sessionId) + // it's possible the session was already resolved by the preview provider + session?.connected() + } + + const project = vitest.getProjectByName(projectName) + + if (!project) { + return error( + new Error(`[vitest] Project "${projectName}" not found.`), + ) + } wss.handleUpgrade(request, socket, head, (ws) => { wss.emit('connection', ws, request) - const rpc = setupClient(sessionId, ws) - const state = server.state + const rpc = setupClient(project, rpcId, ws) + const state = project.browser!.state as BrowserServerState const clients = type === 'tester' ? state.testers : state.orchestrators - clients.set(sessionId, rpc) + clients.set(rpcId, rpc) - debug?.('[%s] Browser API connected to %s', sessionId, type) + debug?.('[%s] Browser API connected to %s', rpcId, type) ws.on('close', () => { - debug?.('[%s] Browser API disconnected from %s', sessionId, type) - clients.delete(sessionId) - server.state.removeCDPHandler(sessionId) + debug?.('[%s] Browser API disconnected from %s', rpcId, type) + clients.delete(rpcId) + globalServer.removeCDPHandler(rpcId) }) }) }) + // we don't throw an error inside a stream because this can segfault the process + function error(err: Error) { + console.error(err) + vitest.state.catchError(err, 'RPC Error') + } + function checkFileAccess(path: string) { if (!isFileServingAllowed(path, vite)) { throw new Error( @@ -61,8 +96,8 @@ export function setupBrowserRpc(server: BrowserServer) { } } - function setupClient(sessionId: string, ws: WebSocket) { - const mockResolver = new ServerMockResolver(server.vite, { + function setupClient(project: TestProject, rpcId: string, ws: WebSocket) { + const mockResolver = new ServerMockResolver(globalServer.vite, { moduleDirectories: project.config.server?.deps?.moduleDirectories, }) @@ -71,34 +106,39 @@ export function setupBrowserRpc(server: BrowserServer) { async onUnhandledError(error, type) { if (error && typeof error === 'object') { const _error = error as ErrorWithDiff - _error.stacks = server.parseErrorStacktrace(_error) + _error.stacks = globalServer.parseErrorStacktrace(_error) } - ctx.state.catchError(error, type) + vitest.state.catchError(error, type) + }, + async onQueued(file) { + vitest.state.collectFiles(project, [file]) + const testModule = vitest.state.getReportedEntity(file) as TestModule + await vitest.report('onTestModuleQueued', testModule) }, async onCollected(files) { - ctx.state.collectFiles(project, files) - await ctx.report('onCollected', files) + vitest.state.collectFiles(project, files) + await vitest.report('onCollected', files) }, async onTaskUpdate(packs) { - ctx.state.updateTasks(packs) - await ctx.report('onTaskUpdate', packs) + vitest.state.updateTasks(packs) + await vitest.report('onTaskUpdate', packs) }, onAfterSuiteRun(meta) { - ctx.coverageProvider?.onAfterSuiteRun(meta) + vitest.coverageProvider?.onAfterSuiteRun(meta) }, sendLog(log) { - return ctx.report('onUserConsoleLog', log) + return vitest.report('onUserConsoleLog', log) }, resolveSnapshotPath(testPath) { - return ctx.snapshot.resolvePath(testPath, { - config: project.getSerializableConfig(), + return vitest.snapshot.resolvePath(testPath, { + config: project.serializedConfig, }) }, resolveSnapshotRawPath(testPath, rawPath) { - return ctx.snapshot.resolveRawPath(testPath, rawPath) + return vitest.snapshot.resolveRawPath(testPath, rawPath) }, snapshotSaved(snapshot) { - ctx.snapshot.add(snapshot) + vitest.snapshot.add(snapshot) }, async readSnapshotFile(snapshotPath) { checkFileAccess(snapshotPath) @@ -120,57 +160,54 @@ export function setupBrowserRpc(server: BrowserServer) { return fs.unlink(id) }, getBrowserFileSourceMap(id) { - const mod = server.vite.moduleGraph.getModuleById(id) + const mod = globalServer.vite.moduleGraph.getModuleById(id) return mod?.transformResult?.map }, onCancel(reason) { - ctx.cancelCurrentRun(reason) + vitest.cancelCurrentRun(reason) }, async resolveId(id, importer) { return mockResolver.resolveId(id, importer) }, debug(...args) { - ctx.logger.console.debug(...args) + vitest.logger.console.debug(...args) }, getCountOfFailedTests() { - return ctx.state.getCountOfFailedTests() + return vitest.state.getCountOfFailedTests() }, - async triggerCommand(contextId, command, testPath, payload) { - debug?.('[%s] Triggering command "%s"', contextId, command) - const provider = server.provider + async triggerCommand(sessionId, command, testPath, payload) { + debug?.('[%s] Triggering command "%s"', sessionId, command) + const provider = project.browser!.provider if (!provider) { throw new Error('Commands are only available for browser tests.') } - const commands = project.config.browser?.commands + const commands = globalServer.commands if (!commands || !commands[command]) { throw new Error(`Unknown command "${command}".`) } - if (provider.beforeCommand) { - await provider.beforeCommand(command, payload) - } + await provider.beforeCommand?.(command, payload) const context = Object.assign( { testPath, project, provider, - contextId, + contextId: sessionId, + sessionId, }, - provider.getCommandsContext(contextId), + provider.getCommandsContext(sessionId), ) as any as BrowserCommandContext let result try { result = await commands[command](context, ...payload) } finally { - if (provider.afterCommand) { - await provider.afterCommand(command, payload) - } + await provider.afterCommand?.(command, payload) } return result }, - finishBrowserTests(contextId: string) { - debug?.('[%s] Finishing browser tests for context', contextId) - return server.state.getContext(contextId)?.resolve() + finishBrowserTests(sessionId: string) { + debug?.('[%s] Finishing browser tests for session', sessionId) + return vitest._browserSessions.getSession(sessionId)?.resolve() }, resolveMock(rawId, importer, options) { return mockResolver.resolveMock(rawId, importer, options) @@ -180,12 +217,12 @@ export function setupBrowserRpc(server: BrowserServer) { }, // CDP - async sendCdpEvent(contextId: string, event: string, payload?: Record) { - const cdp = await server.ensureCDPHandler(contextId, sessionId) + async sendCdpEvent(sessionId: string, event: string, payload?: Record) { + const cdp = await globalServer.ensureCDPHandler(sessionId, rpcId) return cdp.send(event, payload) }, - async trackCdpEvent(contextId: string, type: 'on' | 'once' | 'off', event: string, listenerId: string) { - const cdp = await server.ensureCDPHandler(contextId, sessionId) + async trackCdpEvent(sessionId: string, type: 'on' | 'once' | 'off', event: string, listenerId: string) { + const cdp = await globalServer.ensureCDPHandler(sessionId, rpcId) cdp[type](event, listenerId) }, }, @@ -201,13 +238,13 @@ export function setupBrowserRpc(server: BrowserServer) { }, ) - ctx.onCancel(reason => rpc.onCancel(reason)) + vitest.onCancel(reason => rpc.onCancel(reason)) return rpc } } -// Serialization support utils. +// Serialization support utils. function cloneByOwnProperties(value: any) { // Clones the value's properties into a new Object. The simpler approach of // Object.assign() won't work in the case that properties are not enumerable. diff --git a/packages/browser/src/node/serverOrchestrator.ts b/packages/browser/src/node/serverOrchestrator.ts index ece1471e0f8e..f1d61fd713ef 100644 --- a/packages/browser/src/node/serverOrchestrator.ts +++ b/packages/browser/src/node/serverOrchestrator.ts @@ -1,35 +1,44 @@ import type { IncomingMessage, ServerResponse } from 'node:http' -import type { BrowserServer } from './server' +import type { ProjectBrowser } from './project' +import type { ParentBrowserProject } from './projectParent' import { replacer } from './utils' export async function resolveOrchestrator( - server: BrowserServer, + globalServer: ParentBrowserProject, url: URL, res: ServerResponse, ) { - const project = server.project - let contextId = url.searchParams.get('contextId') + let sessionId = url.searchParams.get('sessionId') // it's possible to open the page without a context - if (!contextId) { - const contexts = [...server.state.orchestrators.keys()] - contextId = contexts[contexts.length - 1] ?? 'none' + if (!sessionId) { + const contexts = [...globalServer.children].flatMap(p => [...p.state.orchestrators.keys()]) + sessionId = contexts[contexts.length - 1] ?? 'none' } - const files = server.state.getContext(contextId!)?.files ?? [] + // it's ok to not have a session here, especially in the preview provider + // because the user could refresh the page which would remove the session id from the url - const injectorJs = typeof server.injectorJs === 'string' - ? server.injectorJs - : await server.injectorJs + const session = globalServer.vitest._browserSessions.getSession(sessionId!) + const files = session?.files ?? [] + const browserProject = (session?.project.browser as ProjectBrowser | undefined) || [...globalServer.children][0] + + if (!browserProject) { + return + } + + const injectorJs = typeof globalServer.injectorJs === 'string' + ? globalServer.injectorJs + : await globalServer.injectorJs const injector = replacer(injectorJs, { - __VITEST_PROVIDER__: JSON.stringify(server.provider.name), - __VITEST_CONFIG__: JSON.stringify(server.getSerializableConfig()), + __VITEST_PROVIDER__: JSON.stringify(browserProject.config.browser.provider || 'preview'), + __VITEST_CONFIG__: JSON.stringify(browserProject.wrapSerializedConfig()), __VITEST_VITE_CONFIG__: JSON.stringify({ - root: server.vite.config.root, + root: browserProject.vite.config.root, }), __VITEST_FILES__: JSON.stringify(files), __VITEST_TYPE__: '"orchestrator"', - __VITEST_CONTEXT_ID__: JSON.stringify(contextId), + __VITEST_SESSION_ID__: JSON.stringify(sessionId), __VITEST_TESTER_ID__: '"none"', __VITEST_PROVIDED_CONTEXT__: '{}', }) @@ -37,9 +46,9 @@ export async function resolveOrchestrator( // disable CSP for the orchestrator as we are the ones controlling it res.removeHeader('Content-Security-Policy') - if (!server.orchestratorScripts) { - server.orchestratorScripts = (await server.formatScripts( - project.config.browser.orchestratorScripts, + if (!globalServer.orchestratorScripts) { + globalServer.orchestratorScripts = (await globalServer.formatScripts( + globalServer.config.browser.orchestratorScripts, )).map((script) => { let html = '`, - __VITEST_ERROR_CATCHER__: ``, - __VITEST_CONTEXT_ID__: JSON.stringify(contextId), + __VITEST_ERROR_CATCHER__: ``, + __VITEST_SESSION_ID__: JSON.stringify(sessionId), }) } diff --git a/packages/browser/src/node/serverTester.ts b/packages/browser/src/node/serverTester.ts index f9ea918796b9..182997506e2d 100644 --- a/packages/browser/src/node/serverTester.ts +++ b/packages/browser/src/node/serverTester.ts @@ -1,13 +1,14 @@ import type { IncomingMessage, ServerResponse } from 'node:http' import type { Connect } from 'vite' -import type { BrowserServer } from './server' +import type { ProjectBrowser } from './project' +import type { ParentBrowserProject } from './projectParent' import crypto from 'node:crypto' import { stringify } from 'flatted' import { join } from 'pathe' import { replacer } from './utils' export async function resolveTester( - server: BrowserServer, + globalServer: ParentBrowserProject, url: URL, res: ServerResponse, next: Connect.NextFunction, @@ -22,9 +23,16 @@ export async function resolveTester( ) } - const { contextId, testFile } = server.resolveTesterUrl(url.pathname) - const project = server.project - const state = server.state + const { sessionId, testFile } = globalServer.resolveTesterUrl(url.pathname) + const session = globalServer.vitest._browserSessions.getSession(sessionId) + + if (!session) { + res.statusCode = 400 + res.end('Invalid session ID') + return + } + + const project = globalServer.vitest.getProjectByName(session.project.name || '') const { testFiles } = await project.globTestFiles() // if decoded test file is "__vitest_all__" or not in the list of known files, run all tests const tests @@ -33,36 +41,43 @@ export async function resolveTester( ? '__vitest_browser_runner__.files' : JSON.stringify([testFile]) const iframeId = JSON.stringify(testFile) - const context = state.getContext(contextId) - const files = context?.files ?? [] - const method = context?.method ?? 'run' + const files = session.files ?? [] + const method = session.method ?? 'run' + + const browserProject = (project.browser as ProjectBrowser | undefined) || [...globalServer.children][0] + + if (!browserProject) { + res.statusCode = 400 + res.end('Invalid session ID') + return + } - const injectorJs = typeof server.injectorJs === 'string' - ? server.injectorJs - : await server.injectorJs + const injectorJs: string = typeof globalServer.injectorJs === 'string' + ? globalServer.injectorJs + : await globalServer.injectorJs const injector = replacer(injectorJs, { - __VITEST_PROVIDER__: JSON.stringify(server.provider.name), - __VITEST_CONFIG__: JSON.stringify(server.getSerializableConfig()), + __VITEST_PROVIDER__: JSON.stringify(project.browser!.provider!.name), + __VITEST_CONFIG__: JSON.stringify(browserProject.wrapSerializedConfig()), __VITEST_FILES__: JSON.stringify(files), __VITEST_VITE_CONFIG__: JSON.stringify({ - root: server.vite.config.root, + root: browserProject.vite.config.root, }), __VITEST_TYPE__: '"tester"', - __VITEST_CONTEXT_ID__: JSON.stringify(contextId), + __VITEST_SESSION_ID__: JSON.stringify(sessionId), __VITEST_TESTER_ID__: JSON.stringify(crypto.randomUUID()), __VITEST_PROVIDED_CONTEXT__: JSON.stringify(stringify(project.getProvidedContext())), }) - const testerHtml = typeof server.testerHtml === 'string' - ? server.testerHtml - : await server.testerHtml + const testerHtml = typeof browserProject.testerHtml === 'string' + ? browserProject.testerHtml + : await browserProject.testerHtml try { - const url = join('/@fs/', server.testerFilepath) - const indexhtml = await server.vite.transformIndexHtml(url, testerHtml) - return replacer(indexhtml, { - __VITEST_FAVICON__: server.faviconUrl, + const url = join('/@fs/', browserProject.testerFilepath) + const indexhtml = await browserProject.vite.transformIndexHtml(url, testerHtml) + const html = replacer(indexhtml, { + __VITEST_FAVICON__: globalServer.faviconUrl, __VITEST_INJECTOR__: injector, __VITEST_APPEND__: ` __vitest_browser_runner__.runningFiles = ${tests} @@ -71,9 +86,10 @@ export async function resolveTester( document.querySelector('script[data-vitest-append]').remove() `, }) + return html } catch (err) { - context?.reject(err) + session.reject(err) next(err) } } diff --git a/packages/browser/src/node/state.ts b/packages/browser/src/node/state.ts index 5e07bd51c33d..eb4eb49689c7 100644 --- a/packages/browser/src/node/state.ts +++ b/packages/browser/src/node/state.ts @@ -1,34 +1,7 @@ -import type { BrowserServerStateContext, BrowserServerState as IBrowserServerState } from 'vitest/node' -import type { BrowserServerCDPHandler } from './cdp' +import type { BrowserServerState as IBrowserServerState } from 'vitest/node' import type { WebSocketBrowserRPC } from './types' -import { createDefer } from '@vitest/utils' export class BrowserServerState implements IBrowserServerState { public readonly orchestrators = new Map() public readonly testers = new Map() - public readonly cdps = new Map() - - private contexts = new Map() - - getContext(contextId: string) { - return this.contexts.get(contextId) - } - - createAsyncContext(method: 'run' | 'collect', contextId: string, files: string[]): Promise { - const defer = createDefer() - this.contexts.set(contextId, { - files, - method, - resolve: () => { - defer.resolve() - this.contexts.delete(contextId) - }, - reject: defer.reject, - }) - return defer - } - - async removeCDPHandler(sessionId: string) { - this.cdps.delete(sessionId) - } } diff --git a/packages/browser/src/node/types.ts b/packages/browser/src/node/types.ts index 91ed6c8c605d..0276dea771c3 100644 --- a/packages/browser/src/node/types.ts +++ b/packages/browser/src/node/types.ts @@ -6,6 +6,7 @@ export interface WebSocketBrowserHandlers { resolveSnapshotPath: (testPath: string) => string resolveSnapshotRawPath: (testPath: string, rawPath: string) => string onUnhandledError: (error: unknown, type: string) => Promise + onQueued: (file: RunnerTestFile) => void onCollected: (files?: RunnerTestFile[]) => Promise onTaskUpdate: (packs: TaskResultPack[]) => void onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void @@ -15,7 +16,7 @@ export interface WebSocketBrowserHandlers { saveSnapshotFile: (id: string, content: string) => Promise removeSnapshotFile: (id: string) => Promise sendLog: (log: UserConsoleLog) => void - finishBrowserTests: (contextId: string) => void + finishBrowserTests: (sessionId: string) => void snapshotSaved: (snapshot: SnapshotResult) => void debug: (...args: string[]) => void resolveId: ( @@ -23,7 +24,7 @@ export interface WebSocketBrowserHandlers { importer?: string ) => Promise triggerCommand: ( - contextId: string, + sessionId: string, command: string, testPath: string | undefined, payload: unknown[] @@ -39,8 +40,8 @@ export interface WebSocketBrowserHandlers { ) => SourceMap | null | { mappings: '' } | undefined // cdp - sendCdpEvent: (contextId: string, event: string, payload?: Record) => unknown - trackCdpEvent: (contextId: string, type: 'on' | 'once' | 'off', event: string, listenerId: string) => void + sendCdpEvent: (sessionId: string, event: string, payload?: Record) => unknown + trackCdpEvent: (sessionId: string, type: 'on' | 'once' | 'off', event: string, listenerId: string) => void } export interface WebSocketEvents diff --git a/packages/coverage-v8/package.json b/packages/coverage-v8/package.json index fba51cf870f5..30fb28da2462 100644 --- a/packages/coverage-v8/package.json +++ b/packages/coverage-v8/package.json @@ -61,7 +61,7 @@ "istanbul-lib-report": "^3.0.1", "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.1.7", - "magic-string": "^0.30.14", + "magic-string": "^0.30.17", "magicast": "^0.3.5", "std-env": "^3.8.0", "test-exclude": "^7.0.1", diff --git a/packages/mocker/package.json b/packages/mocker/package.json index 172bfd11bfdc..83848e045982 100644 --- a/packages/mocker/package.json +++ b/packages/mocker/package.json @@ -68,14 +68,14 @@ "dependencies": { "@vitest/spy": "workspace:*", "estree-walker": "^3.0.3", - "magic-string": "^0.30.14" + "magic-string": "^0.30.17" }, "devDependencies": { "@types/estree": "^1.0.6", "@vitest/spy": "workspace:*", "@vitest/utils": "workspace:*", "acorn-walk": "^8.3.4", - "msw": "^2.6.8", + "msw": "^2.7.0", "pathe": "^1.1.2", "vite": "^5.4.0" } diff --git a/packages/mocker/src/browser/interceptor-msw.ts b/packages/mocker/src/browser/interceptor-msw.ts index 53f50899ddad..fe480d913046 100644 --- a/packages/mocker/src/browser/interceptor-msw.ts +++ b/packages/mocker/src/browser/interceptor-msw.ts @@ -128,10 +128,11 @@ export class ModuleMockerMSWInterceptor implements ModuleMockerInterceptor { } } -const timestampRegexp = /(\?|&)t=\d{13}/ -const versionRegexp = /(\?|&)v=\w{8}/ +const trailingSeparatorRE = /[?&]$/ +const timestampRE = /\bt=\d{13}&?\b/ +const versionRE = /\bv=\w{8}&?\b/ function cleanQuery(url: string) { - return url.replace(timestampRegexp, '').replace(versionRegexp, '') + return url.replace(timestampRE, '').replace(versionRE, '').replace(trailingSeparatorRE, '') } function passthrough() { diff --git a/packages/runner/src/collect.ts b/packages/runner/src/collect.ts index 33634d598806..bcab0e86629c 100644 --- a/packages/runner/src/collect.ts +++ b/packages/runner/src/collect.ts @@ -107,6 +107,10 @@ export async function collectTests( config.allowOnly, ) + if (file.mode === 'queued') { + file.mode = 'run' + } + files.push(file) } diff --git a/packages/runner/src/fixture.ts b/packages/runner/src/fixture.ts index cd073ec911e3..34a12f4e27d6 100644 --- a/packages/runner/src/fixture.ts +++ b/packages/runner/src/fixture.ts @@ -5,10 +5,6 @@ import { getFixture } from './map' export interface FixtureItem extends FixtureOptions { prop: string value: any - /** - * Indicated if the injected value should be preferred over the fixture value - */ - injected?: boolean /** * Indicates whether the fixture is a function */ diff --git a/packages/runner/src/run.ts b/packages/runner/src/run.ts index bb3fa918ee8f..e29f54435946 100644 --- a/packages/runner/src/run.ts +++ b/packages/runner/src/run.ts @@ -196,7 +196,7 @@ async function callCleanupHooks(cleanups: HookCleanupCallback[]) { export async function runTest(test: Test, runner: VitestRunner): Promise { await runner.onBeforeRunTask?.(test) - if (test.mode !== 'run') { + if (test.mode !== 'run' && test.mode !== 'queued') { return } @@ -458,7 +458,7 @@ export async function runSuite(suite: Suite, runner: VitestRunner): Promise = (value: T) => Promise diff --git a/packages/runner/src/utils/collect.ts b/packages/runner/src/utils/collect.ts index 468f6200aaa3..ed47ad67c531 100644 --- a/packages/runner/src/utils/collect.ts +++ b/packages/runner/src/utils/collect.ts @@ -72,8 +72,8 @@ export function interpretTaskModes( }) // if all subtasks are skipped, mark as skip - if (suite.mode === 'run') { - if (suite.tasks.length && suite.tasks.every(i => i.mode !== 'run')) { + if (suite.mode === 'run' || suite.mode === 'queued') { + if (suite.tasks.length && suite.tasks.every(i => i.mode !== 'run' && i.mode !== 'queued')) { suite.mode = 'skip' } } @@ -115,7 +115,7 @@ export function someTasksAreOnly(suite: Suite): boolean { function skipAllTasks(suite: Suite) { suite.tasks.forEach((t) => { - if (t.mode === 'run') { + if (t.mode === 'run' || t.mode === 'queued') { t.mode = 'skip' if (t.type === 'suite') { skipAllTasks(t) @@ -172,7 +172,7 @@ export function createFileTask( id: generateFileHash(path, projectName), name: path, type: 'suite', - mode: 'run', + mode: 'queued', filepath, tasks: [], meta: Object.create(null), diff --git a/packages/snapshot/package.json b/packages/snapshot/package.json index 9ea29581b896..403eeea4bc2a 100644 --- a/packages/snapshot/package.json +++ b/packages/snapshot/package.json @@ -43,7 +43,7 @@ }, "dependencies": { "@vitest/pretty-format": "workspace:*", - "magic-string": "^0.30.14", + "magic-string": "^0.30.17", "pathe": "^1.1.2" }, "devDependencies": { diff --git a/packages/ui/package.json b/packages/ui/package.json index 47675d8e9cdd..3f96b0730798 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -57,14 +57,14 @@ }, "devDependencies": { "@faker-js/faker": "^9.3.0", - "@iconify-json/carbon": "^1.2.4", - "@iconify-json/logos": "^1.2.3", + "@iconify-json/carbon": "^1.2.5", + "@iconify-json/logos": "^1.2.4", "@testing-library/vue": "^8.1.0", "@types/codemirror": "^5.60.15", "@types/d3-force": "^3.0.10", "@types/d3-selection": "^3.0.11", "@types/ws": "^8.5.13", - "@unocss/reset": "^0.65.1", + "@unocss/reset": "^0.65.2", "@vitejs/plugin-vue": "^5.2.1", "@vitest/runner": "workspace:*", "@vitest/ws-client": "workspace:*", @@ -78,9 +78,9 @@ "floating-vue": "^5.2.2", "rollup": "^4.28.1", "splitpanes": "^3.1.5", - "unocss": "^0.65.1", - "unplugin-auto-import": "^0.18.6", - "unplugin-vue-components": "^0.27.5", + "unocss": "^0.65.2", + "unplugin-auto-import": "^0.19.0", + "unplugin-vue-components": "^0.28.0", "vite": "^5.0.0", "vite-plugin-pages": "^0.32.4", "vue": "^3.5.12", diff --git a/packages/vitest/package.json b/packages/vitest/package.json index f11892391c1d..4c6122dc1b26 100644 --- a/packages/vitest/package.json +++ b/packages/vitest/package.json @@ -160,7 +160,7 @@ "chai": "^5.1.2", "debug": "^4.4.0", "expect-type": "^1.1.0", - "magic-string": "^0.30.14", + "magic-string": "^0.30.17", "pathe": "^1.1.2", "std-env": "^3.8.0", "tinybench": "^2.9.0", @@ -182,7 +182,7 @@ "@types/istanbul-reports": "^3.0.4", "@types/jsdom": "^21.1.7", "@types/micromatch": "^4.0.9", - "@types/node": "^22.10.1", + "@types/node": "^22.10.2", "@types/prompts": "^2.4.9", "@types/sinonjs__fake-timers": "^8.1.5", "acorn-walk": "^8.3.4", diff --git a/packages/vitest/src/api/setup.ts b/packages/vitest/src/api/setup.ts index 879d662b60ad..d362d2ba5bc3 100644 --- a/packages/vitest/src/api/setup.ts +++ b/packages/vitest/src/api/setup.ts @@ -97,11 +97,13 @@ export function setup(ctx: Vitest, _server?: ViteDevServer) { async getModuleGraph(project, id, browser): Promise { return getModuleGraph(ctx, project, id, browser) }, - updateSnapshot(file?: File) { + async updateSnapshot(file?: File) { if (!file) { - return ctx.updateSnapshot() + await ctx.updateSnapshot() + } + else { + await ctx.updateSnapshot([file.filepath]) } - return ctx.updateSnapshot([file.filepath]) }, getUnhandledErrors() { return ctx.state.getUnhandledErrors() diff --git a/packages/vitest/src/create/browser/creator.ts b/packages/vitest/src/create/browser/creator.ts index 31875b2932b2..239bfe2fdd42 100644 --- a/packages/vitest/src/create/browser/creator.ts +++ b/packages/vitest/src/create/browser/creator.ts @@ -228,9 +228,9 @@ function getPossibleProvider(dependencies: Record) { function getProviderDocsLink(provider: string) { switch (provider) { case 'playwright': - return 'https://playwright.dev' + return 'https://vitest.dev/guide/browser/playwright' case 'webdriverio': - return 'https://webdriver.io' + return 'https://vitest.dev/guide/browser/webdriverio' } } @@ -251,7 +251,7 @@ async function generateWorkspaceFile(options: { configPath: string rootConfig: string provider: string - browser: string + browsers: string[] }) { const relativeRoot = relative(dirname(options.configPath), options.rootConfig) const workspaceContent = [ @@ -265,10 +265,11 @@ async function generateWorkspaceFile(options: { ` test: {`, ` browser: {`, ` enabled: true,`, - ` name: '${options.browser}',`, ` provider: '${options.provider}',`, options.provider !== 'preview' && ` // ${getProviderDocsLink(options.provider)}`, - options.provider !== 'preview' && ` providerOptions: {},`, + ` configs: [`, + ...options.browsers.map(browser => ` { browser: '${browser}' },`), + ` ],`, ` },`, ` },`, ` },`, @@ -283,7 +284,7 @@ async function generateFrameworkConfigFile(options: { framework: string frameworkPlugin: string | null provider: string - browser: string + browsers: string[] }) { const frameworkImport = options.framework === 'svelte' ? `import { svelte } from '${options.frameworkPlugin}'` @@ -297,10 +298,11 @@ async function generateFrameworkConfigFile(options: { ` test: {`, ` browser: {`, ` enabled: true,`, - ` name: '${options.browser}',`, ` provider: '${options.provider}',`, options.provider !== 'preview' && ` // ${getProviderDocsLink(options.provider)}`, - options.provider !== 'preview' && ` providerOptions: {},`, + ` configs: [`, + ...options.browsers.map(browser => ` { browser: '${browser}' },`), + ` ],`, ` },`, ` },`, `})`, @@ -391,9 +393,10 @@ export async function create() { return fail() } - const { browser } = await prompt({ - type: 'select', - name: 'browser', + // TODO: allow multiselect + const { browsers } = await prompt({ + type: 'multiselect', + name: 'browsers', message: 'Choose a browser', choices: getBrowserNames(provider).map(browser => ({ title: browser, @@ -471,7 +474,7 @@ export async function create() { configPath: browserWorkspaceFile, rootConfig, provider, - browser, + browsers, }) log(c.green('✔'), 'Created a workspace file for browser tests:', c.bold(relative(process.cwd(), browserWorkspaceFile))) } @@ -482,7 +485,7 @@ export async function create() { framework, frameworkPlugin, provider, - browser, + browsers, }) log(c.green('✔'), 'Created a config file for browser tests', c.bold(relative(process.cwd(), configPath))) } diff --git a/packages/vitest/src/node/browser/sessions.ts b/packages/vitest/src/node/browser/sessions.ts new file mode 100644 index 000000000000..b6847e000b05 --- /dev/null +++ b/packages/vitest/src/node/browser/sessions.ts @@ -0,0 +1,34 @@ +import type { TestProject } from '../project' +import type { BrowserServerStateSession } from '../types/browser' +import { createDefer } from '@vitest/utils' + +export class BrowserSessions { + private sessions = new Map() + + getSession(sessionId: string) { + return this.sessions.get(sessionId) + } + + createAsyncSession(method: 'run' | 'collect', sessionId: string, files: string[], project: TestProject): Promise { + const defer = createDefer() + + const timeout = setTimeout(() => { + defer.reject(new Error(`Failed to connect to the browser session "${sessionId}" within the timeout.`)) + }, project.vitest.config.browser.connectTimeout ?? 60_000).unref() + + this.sessions.set(sessionId, { + files, + method, + project, + connected: () => { + clearTimeout(timeout) + }, + resolve: () => { + defer.resolve() + this.sessions.delete(sessionId) + }, + reject: defer.reject, + }) + return defer + } +} diff --git a/packages/vitest/src/node/cli/cac.ts b/packages/vitest/src/node/cli/cac.ts index b0a8de330fb4..0fb1d604a9ad 100644 --- a/packages/vitest/src/node/cli/cac.ts +++ b/packages/vitest/src/node/cli/cac.ts @@ -256,6 +256,14 @@ function normalizeCliOptions(cliFilters: string[], argv: CliOptions): CliOptions argv.includeTaskLocation ??= true } + // running "vitest --browser.headless" + if (typeof argv.browser === 'object' && !('enabled' in argv.browser)) { + argv.browser.enabled = true + } + if (typeof argv.typecheck?.only === 'boolean') { + argv.typecheck.enabled ??= true + } + return argv } diff --git a/packages/vitest/src/node/cli/cli-api.ts b/packages/vitest/src/node/cli/cli-api.ts index 4272c30064ad..5edaac0e073a 100644 --- a/packages/vitest/src/node/cli/cli-api.ts +++ b/packages/vitest/src/node/cli/cli-api.ts @@ -143,15 +143,6 @@ export async function prepareVitest( // this shouldn't affect _application root_ that can be changed inside config const root = resolve(options.root || process.cwd()) - // running "vitest --browser.headless" - if (typeof options.browser === 'object' && !('enabled' in options.browser)) { - options.browser.enabled = true - } - - if (typeof options.typecheck?.only === 'boolean') { - options.typecheck.enabled ??= true - } - const ctx = await createVitest(mode, options, viteOverrides, vitestOptions) const environmentPackage = getEnvPackageName(ctx.config.environment) diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index 57f7f0186bc2..6e9db83aa22f 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -371,7 +371,7 @@ export const cliOptionsConfig: VitestCLIOptions = { }, name: { description: - 'Run all tests in a specific browser. Some browsers are only available for specific providers (see `--browser.provider`). Visit [`browser.name`](https://vitest.dev/config/#browser-name) for more information', + 'Run all tests in a specific browser. Some browsers are only available for specific providers (see `--browser.provider`). Visit [`browser.name`](https://vitest.dev/guide/browser/config/#browser-name) for more information', argument: '', }, headless: { @@ -408,6 +408,10 @@ export const cliOptionsConfig: VitestCLIOptions = { description: 'Should browser test files run in parallel. Use `--browser.fileParallelism=false` to disable (default: `true`)', }, + connectTimeout: { + description: 'If connection to the browser takes longer, the test suite will fail (default: `60_000`)', + argument: '', + }, orchestratorScripts: null, testerScripts: null, commands: null, @@ -416,6 +420,7 @@ export const cliOptionsConfig: VitestCLIOptions = { screenshotFailures: null, locators: null, testerHtmlPath: null, + instances: null, }, }, pool: { diff --git a/packages/vitest/src/node/config/resolveConfig.ts b/packages/vitest/src/node/config/resolveConfig.ts index 78f19e22094a..24f1a59d8687 100644 --- a/packages/vitest/src/node/config/resolveConfig.ts +++ b/packages/vitest/src/node/config/resolveConfig.ts @@ -230,9 +230,30 @@ export function resolveConfig( } } + const browser = resolved.browser + + if (browser.enabled) { + if (!browser.name && !browser.instances) { + throw new Error(`Vitest Browser Mode requires "browser.name" (deprecated) or "browser.instances" options, none were set.`) + } + + const configs = browser.instances + if (browser.name && browser.instances) { + // --browser=chromium filters configs to a single one + browser.instances = browser.instances.filter(instance => instance.browser === browser.name) + } + + if (browser.instances && !browser.instances.length) { + throw new Error([ + `"browser.instances" was set in the config, but the array is empty. Define at least one browser config.`, + browser.name && configs?.length ? ` The "browser.name" was set to "${browser.name}" which filtered all configs (${configs.map(c => c.browser).join(', ')}). Did you mean to use another name?` : '', + ].join('')) + } + } + // Browser-mode "Playwright + Chromium" only features: - if (resolved.browser.enabled && !(resolved.browser.provider === 'playwright' && resolved.browser.name === 'chromium')) { - const browserConfig = { browser: { provider: resolved.browser.provider, name: resolved.browser.name } } + if (browser.enabled && !(browser.provider === 'playwright' && browser.name === 'chromium')) { + const browserConfig = { browser: { provider: browser.provider, name: browser.name } } if (resolved.coverage.enabled && resolved.coverage.provider === 'v8') { throw new Error( @@ -557,6 +578,7 @@ export function resolveConfig( } // override test config resolved.coverage.enabled = false + resolved.typecheck.enabled = false resolved.include = resolved.benchmark.include resolved.exclude = resolved.benchmark.exclude resolved.includeSource = resolved.benchmark.includeSource diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts index 927c2005efaf..6be0b052ab39 100644 --- a/packages/vitest/src/node/core.ts +++ b/packages/vitest/src/node/core.ts @@ -24,6 +24,7 @@ import { defaultBrowserPort, workspacesFiles as workspaceFiles } from '../consta import { getCoverageProvider } from '../integrations/coverage' import { distDir } from '../paths' import { wildcardPatternToRegExp } from '../utils/base' +import { BrowserSessions } from './browser/sessions' import { VitestCache } from './cache' import { resolveConfig } from './config/resolveConfig' import { FilesNotFoundError } from './errors' @@ -36,7 +37,7 @@ import { createBenchmarkReporters, createReporters } from './reporters/utils' import { VitestSpecifications } from './specifications' import { StateManager } from './state' import { VitestWatcher } from './watcher' -import { resolveWorkspace } from './workspace/resolveWorkspace' +import { resolveBrowserWorkspace, resolveWorkspace } from './workspace/resolveWorkspace' const WATCHER_DEBOUNCE = 100 @@ -88,6 +89,7 @@ export class Vitest { /** @internal */ coreWorkspaceProject: TestProject | undefined /** @internal */ resolvedProjects: TestProject[] = [] /** @internal */ _browserLastPort = defaultBrowserPort + /** @internal */ _browserSessions = new BrowserSessions() /** @internal */ _options: UserConfig = {} /** @internal */ reporters: Reporter[] = undefined! /** @internal */ vitenode: ViteNodeServer = undefined! @@ -390,7 +392,7 @@ export class Vitest { this._workspaceConfigPath = workspaceConfigPath if (!workspaceConfigPath) { - return [this._ensureRootProject()] + return resolveBrowserWorkspace(this, new Set(), [this._ensureRootProject()]) } const workspaceModule = await this.import<{ @@ -817,7 +819,7 @@ export class Vitest { } /** @internal */ - async rerunFiles(files: string[] = this.state.getFilepaths(), trigger?: string, allTestsRun = true, resetTestNamePattern = false): Promise { + async rerunFiles(files: string[] = this.state.getFilepaths(), trigger?: string, allTestsRun = true, resetTestNamePattern = false): Promise { if (resetTestNamePattern) { this.configOverride.testNamePattern = undefined } @@ -832,9 +834,10 @@ export class Vitest { this.report('onWatcherRerun', files, trigger), ...this._onUserTestsRerun.map(fn => fn(specifications)), ]) - await this.runFiles(specifications, allTestsRun) + const testResult = await this.runFiles(specifications, allTestsRun) await this.report('onWatcherStart', this.state.getFiles(files)) + return testResult } /** @internal */ @@ -900,8 +903,11 @@ export class Vitest { await this.rerunFiles(this.state.getFailedFilepaths(), 'rerun failed', false) } - /** @internal */ - async updateSnapshot(files?: string[]): Promise { + /** + * Update snapshots in specified files. If no files are provided, it will update files with failed tests and obsolete snapshots. + * @param files The list of files on the file system + */ + async updateSnapshot(files?: string[]): Promise { // default to failed files files = files || [ ...this.state.getFailedFilepaths(), @@ -911,7 +917,7 @@ export class Vitest { this.enableSnapshotUpdate() try { - await this.rerunFiles(files, 'update snapshot', false) + return await this.rerunFiles(files, 'update snapshot', false) } finally { this.resetSnapshotUpdate() diff --git a/packages/vitest/src/node/packageInstaller.ts b/packages/vitest/src/node/packageInstaller.ts index 4189e88347d9..7a443681e092 100644 --- a/packages/vitest/src/node/packageInstaller.ts +++ b/packages/vitest/src/node/packageInstaller.ts @@ -2,7 +2,7 @@ import { createRequire } from 'node:module' import url from 'node:url' import { isPackageExists } from 'local-pkg' import c from 'tinyrainbow' -import { isCI } from '../utils/env' +import { isTTY } from '../utils/env' const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) @@ -31,8 +31,6 @@ export class VitestPackageInstaller { return true } - const promptInstall = !isCI && process.stdout.isTTY - process.stderr.write( c.red( `${c.inverse( @@ -41,12 +39,12 @@ export class VitestPackageInstaller { ), ) - if (!promptInstall) { + if (!isTTY) { return false } const prompts = await import('prompts') - const { install } = await prompts.prompt({ + const { install } = await prompts.default({ type: 'confirm', name: 'install', message: c.reset(`Do you want to install ${c.green(dependency)}?`), diff --git a/packages/vitest/src/node/pools/rpc.ts b/packages/vitest/src/node/pools/rpc.ts index 91cfc08f7f3b..919e15d6d9eb 100644 --- a/packages/vitest/src/node/pools/rpc.ts +++ b/packages/vitest/src/node/pools/rpc.ts @@ -1,6 +1,7 @@ import type { RawSourceMap } from 'vite-node' import type { RuntimeRPC } from '../../types/rpc' import type { TestProject } from '../project' +import type { TestModule } from '../reporters/reported-tasks' import type { ResolveSnapshotPathHandlerContext } from '../types/config' import { mkdir, writeFile } from 'node:fs/promises' import { join } from 'pathe' @@ -78,6 +79,11 @@ export function createMethodsRPC(project: TestProject, options: MethodsOptions = ctx.state.collectPaths(paths) return ctx.report('onPathsCollected', paths) }, + onQueued(file) { + ctx.state.collectFiles(project, [file]) + const testModule = ctx.state.getReportedEntity(file) as TestModule + return ctx.report('onTestModuleQueued', testModule) + }, onCollected(files) { ctx.state.collectFiles(project, files) return ctx.report('onCollected', files) diff --git a/packages/vitest/src/node/project.ts b/packages/vitest/src/node/project.ts index 864a3ed1bed4..1e156da24c5c 100644 --- a/packages/vitest/src/node/project.ts +++ b/packages/vitest/src/node/project.ts @@ -9,7 +9,7 @@ import type { ProvidedContext } from '../types/general' import type { OnTestsRerunHandler, Vitest } from './core' import type { GlobalSetupFile } from './globalSetup' import type { Logger } from './logger' -import type { BrowserServer } from './types/browser' +import type { ParentProjectBrowser, ProjectBrowser } from './types/browser' import type { ResolvedConfig, SerializedConfig, @@ -52,7 +52,7 @@ export class TestProject { /** * Browser instance if the browser is enabled. This is initialized when the tests run for the first time. */ - public browser?: BrowserServer + public browser?: ProjectBrowser /** @deprecated use `vitest` instead */ public ctx: Vitest @@ -64,6 +64,7 @@ export class TestProject { /** @internal */ vitenode!: ViteNodeServer /** @internal */ typechecker?: Typechecker + /** @internal */ _config?: ResolvedConfig private runner!: ViteNodeRunner @@ -74,14 +75,12 @@ export class TestProject { private _globalSetups?: GlobalSetupFile[] private _provided: ProvidedContext = {} as any - private _config?: ResolvedConfig private _vite?: ViteDevServer constructor( /** @deprecated */ public path: string | number, vitest: Vitest, - /** @deprecated */ public options?: InitializeProjectOptions, ) { this.vitest = vitest @@ -161,6 +160,12 @@ export class TestProject { if (!this._vite) { throw new Error('The server was not set. It means that `project.vite` was called before the Vite server was established.') } + // checking it once should be enough + Object.defineProperty(this, 'vite', { + configurable: true, + writable: true, + value: this._vite, + }) return this._vite } @@ -171,6 +176,12 @@ export class TestProject { if (!this._config) { throw new Error('The config was not set. It means that `project.config` was called before the Vite server was established.') } + // checking it once should be enough + // Object.defineProperty(this, 'config', { + // configurable: true, + // writable: true, + // value: this._config, + // }) return this._config } @@ -481,11 +492,19 @@ export class TestProject { } /** @internal */ - async _initBrowserServer() { - if (!this.isBrowserEnabled() || this.browser) { + _parentBrowser?: ParentProjectBrowser + /** @internal */ + _parent?: TestProject + /** @internal */ + _initParentBrowser = deduped(async () => { + if (!this.isBrowserEnabled() || this._parentBrowser) { return } - await this.vitest.packageInstaller.ensureInstalled('@vitest/browser', this.config.root, this.ctx.version) + await this.vitest.packageInstaller.ensureInstalled( + '@vitest/browser', + this.config.root, + this.vitest.version, + ) const { createBrowserServer, distRoot } = await import('@vitest/browser') const browser = await createBrowserServer( this, @@ -500,13 +519,22 @@ export class TestProject { }, }), ], - [CoverageTransform(this.ctx)], + [CoverageTransform(this.vitest)], ) - this.browser = browser + this._parentBrowser = browser if (this.config.browser.ui) { setup(this.vitest, browser.vite) } - } + }) + + /** @internal */ + _initBrowserServer = deduped(async () => { + await this._parent?._initParentBrowser() + + if (!this.browser && this._parent?._parentBrowser) { + this.browser = this._parent._parentBrowser.spawn(this) + } + }) /** * Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts. @@ -614,14 +642,26 @@ export class TestProject { } /** @internal */ - async _initBrowserProvider(): Promise { + _initBrowserProvider = deduped(async (): Promise => { if (!this.isBrowserEnabled() || this.browser?.provider) { return } if (!this.browser) { await this._initBrowserServer() } - await this.browser?.initBrowserProvider() + await this.browser?.initBrowserProvider(this) + }) + + /** @internal */ + public _provideObject(context: Partial): void { + for (const _providedKey in context) { + const providedKey = _providedKey as keyof ProvidedContext + // type is very strict here, so we cast it to any + (this.provide as (key: string, value: unknown) => void)( + providedKey, + context[providedKey], + ) + } } /** @internal */ @@ -634,16 +674,36 @@ export class TestProject { project.runner = vitest.runner project._vite = vitest.server project._config = vitest.config - for (const _providedKey in vitest.config.provide) { - const providedKey = _providedKey as keyof ProvidedContext - // type is very strict here, so we cast it to any - (project.provide as (key: string, value: unknown) => void)( - providedKey, - vitest.config.provide[providedKey], - ) - } + project._provideObject(vitest.config.provide) return project } + + /** @internal */ + static _cloneBrowserProject(parent: TestProject, config: ResolvedConfig): TestProject { + const clone = new TestProject( + parent.path, + parent.vitest, + ) + clone.vitenode = parent.vitenode + clone.runner = parent.runner + clone._vite = parent._vite + clone._config = config + clone._parent = parent + clone._provideObject(config.provide) + return clone + } +} + +function deduped Promise>(cb: T): T { + let _promise: Promise | undefined + return ((...args: any[]) => { + if (!_promise) { + _promise = cb(...args).finally(() => { + _promise = undefined + }) + } + return _promise + }) as T } export { diff --git a/packages/vitest/src/node/reporters/base.ts b/packages/vitest/src/node/reporters/base.ts index e4c9d42abb2d..c31b30a29c9d 100644 --- a/packages/vitest/src/node/reporters/base.ts +++ b/packages/vitest/src/node/reporters/base.ts @@ -8,7 +8,7 @@ import { toArray } from '@vitest/utils' import { parseStacktrace } from '@vitest/utils/source-map' import { relative } from 'pathe' import c from 'tinyrainbow' -import { isCI, isDeno, isNode } from '../../utils/env' +import { isTTY } from '../../utils/env' import { hasFailedSnapshot } from '../../utils/tasks' import { F_CHECK, F_POINTER, F_RIGHT } from './renderers/figures' import { countTestErrors, divider, formatProjectName, formatTime, formatTimeString, getStateString, getStateSymbol, padSummaryTitle, renderSnapshotSummary, taskFail, withLabel } from './renderers/utils' @@ -34,7 +34,7 @@ export abstract class BaseReporter implements Reporter { private _timeStart = formatTimeString(new Date()) constructor(options: BaseOptions = {}) { - this.isTTY = options.isTTY ?? ((isNode || isDeno) && process.stdout?.isTTY && !isCI) + this.isTTY = options.isTTY ?? isTTY } onInit(ctx: Vitest) { @@ -75,7 +75,8 @@ export abstract class BaseReporter implements Reporter { if ( !('filepath' in task) || !task.result?.state - || task.result?.state === 'run') { + || task.result?.state === 'run' + || task.result?.state === 'queued') { return } @@ -152,7 +153,7 @@ export abstract class BaseReporter implements Reporter { } else if (this.renderSucceed || anyFailed) { - this.log(` ${c.dim(getStateSymbol(test))} ${getTestName(test, c.dim(' > '))}${suffix}`) + this.log(` ${getStateSymbol(test)} ${getTestName(test, c.dim(' > '))}${suffix}`) } } } diff --git a/packages/vitest/src/node/reporters/benchmark/table/index.ts b/packages/vitest/src/node/reporters/benchmark/table/index.ts index 2ae1ae61fa62..f7ab74f3422d 100644 --- a/packages/vitest/src/node/reporters/benchmark/table/index.ts +++ b/packages/vitest/src/node/reporters/benchmark/table/index.ts @@ -76,12 +76,13 @@ export class TableReporter extends BaseReporter { && task.type === 'suite' && task.result?.state && task.result?.state !== 'run' + && task.result?.state !== 'queued' ) { // render static table when all benches inside single suite are finished const benches = task.tasks.filter(t => t.meta.benchmark) if ( benches.length > 0 - && benches.every(t => t.result?.state !== 'run') + && benches.every(t => t.result?.state !== 'run' && t.result?.state !== 'queued') ) { let title = ` ${getStateSymbol(task)} ${getFullName( task, diff --git a/packages/vitest/src/node/reporters/default.ts b/packages/vitest/src/node/reporters/default.ts index 5ac02191fcab..76181ec27f6c 100644 --- a/packages/vitest/src/node/reporters/default.ts +++ b/packages/vitest/src/node/reporters/default.ts @@ -1,6 +1,7 @@ import type { File, TaskResultPack } from '@vitest/runner' import type { Vitest } from '../core' import type { BaseOptions } from './base' +import type { TestModule } from './reported-tasks' import { BaseReporter } from './base' import { SummaryReporter } from './summary' @@ -28,6 +29,10 @@ export class DefaultReporter extends BaseReporter { } } + onTestModuleQueued(file: TestModule) { + this.summary?.onTestModuleQueued(file) + } + onInit(ctx: Vitest) { super.onInit(ctx) this.summary?.onInit(ctx, { verbose: this.verbose }) diff --git a/packages/vitest/src/node/reporters/json.ts b/packages/vitest/src/node/reporters/json.ts index 1b46c62bd2ab..f77f354a82f2 100644 --- a/packages/vitest/src/node/reporters/json.ts +++ b/packages/vitest/src/node/reporters/json.ts @@ -26,6 +26,7 @@ const StatusMap: Record = { run: 'pending', skip: 'skipped', todo: 'todo', + queued: 'pending', } export interface JsonAssertionResult { @@ -95,7 +96,7 @@ export class JsonReporter implements Reporter { const numFailedTestSuites = suites.filter(s => s.result?.state === 'fail').length const numPendingTestSuites = suites.filter( - s => s.result?.state === 'run' || s.mode === 'todo', + s => s.result?.state === 'run' || s.result?.state === 'queued' || s.mode === 'todo', ).length const numPassedTestSuites = numTotalTestSuites - numFailedTestSuites - numPendingTestSuites @@ -104,7 +105,7 @@ export class JsonReporter implements Reporter { ).length const numPassedTests = tests.filter(t => t.result?.state === 'pass').length const numPendingTests = tests.filter( - t => t.result?.state === 'run' || t.mode === 'skip' || t.result?.state === 'skip', + t => t.result?.state === 'run' || t.result?.state === 'queued' || t.mode === 'skip' || t.result?.state === 'skip', ).length const numTodoTests = tests.filter(t => t.mode === 'todo').length const testResults: Array = [] @@ -154,7 +155,7 @@ export class JsonReporter implements Reporter { } satisfies JsonAssertionResult }) - if (tests.some(t => t.result?.state === 'run')) { + if (tests.some(t => t.result?.state === 'run' || t.result?.state === 'queued')) { this.ctx.logger.warn( 'WARNING: Some tests are still running when generating the JSON report.' + 'This is likely an internal bug in Vitest.' diff --git a/packages/vitest/src/node/reporters/renderers/utils.ts b/packages/vitest/src/node/reporters/renderers/utils.ts index 9aa777a08d84..a8f057dba45e 100644 --- a/packages/vitest/src/node/reporters/renderers/utils.ts +++ b/packages/vitest/src/node/reporters/renderers/utils.ts @@ -163,7 +163,7 @@ export function getStateSymbol(task: Task) { return pending } - if (task.result.state === 'run') { + if (task.result.state === 'run' || task.result.state === 'queued') { if (task.type === 'suite') { return pointer } diff --git a/packages/vitest/src/node/reporters/reported-tasks.ts b/packages/vitest/src/node/reporters/reported-tasks.ts index fa881accdb99..8e175fdf96d3 100644 --- a/packages/vitest/src/node/reporters/reported-tasks.ts +++ b/packages/vitest/src/node/reporters/reported-tasks.ts @@ -126,7 +126,7 @@ export class TestCase extends ReportedTaskImplementation { */ public result(): TestResult | undefined { const result = this.task.result - if (!result || result.state === 'run') { + if (!result || result.state === 'run' || result.state === 'queued') { return undefined } const state = result.state === 'fail' @@ -175,7 +175,7 @@ export class TestCase extends ReportedTaskImplementation { public diagnostic(): TestDiagnostic | undefined { const result = this.task.result // startTime should always be available if the test has properly finished - if (!result || result.state === 'run' || !result.startTime) { + if (!result || result.state === 'run' || result.state === 'queued' || !result.startTime) { return undefined } const duration = result.duration || 0 @@ -450,7 +450,7 @@ export interface TaskOptions { shuffle: boolean | undefined retry: number | undefined repeats: number | undefined - mode: 'run' | 'only' | 'skip' | 'todo' + mode: 'run' | 'only' | 'skip' | 'todo' | 'queued' } function buildOptions( diff --git a/packages/vitest/src/node/reporters/summary.ts b/packages/vitest/src/node/reporters/summary.ts index 9646c2ac5bb4..97488cc97410 100644 --- a/packages/vitest/src/node/reporters/summary.ts +++ b/packages/vitest/src/node/reporters/summary.ts @@ -1,6 +1,7 @@ import type { File, Test } from '@vitest/runner' import type { Vitest } from '../core' import type { Reporter } from '../types/reporter' +import type { TestModule } from './reported-tasks' import type { HookOptions } from './task-parser' import { getTests } from '@vitest/runner/utils' import c from 'tinyrainbow' @@ -87,6 +88,10 @@ export class SummaryReporter extends TaskParser implements Reporter { }) } + onTestModuleQueued(module: TestModule) { + this.onTestFilePrepare(module.task) + } + onPathsCollected(paths?: string[]) { this.suites.total = (paths || []).length } @@ -111,7 +116,18 @@ export class SummaryReporter extends TaskParser implements Reporter { } onTestFilePrepare(file: File) { - if (this.allFinishedTests.has(file.id) || this.runningTests.has(file.id)) { + if (this.runningTests.has(file.id)) { + const stats = this.runningTests.get(file.id)! + // if there are no tests, it means the test was queued but not collected + if (!stats.total) { + const total = getTests(file).length + this.tests.total += total + stats.total = total + } + return + } + + if (this.allFinishedTests.has(file.id)) { return } @@ -266,7 +282,7 @@ export class SummaryReporter extends TaskParser implements Reporter { const file = test.file let stats = this.runningTests.get(file.id) - if (!stats) { + if (!stats || stats.total === 0) { // It's possible that that test finished before it's preparation was even reported this.onTestFilePrepare(test.file) stats = this.runningTests.get(file.id)! @@ -303,7 +319,9 @@ export class SummaryReporter extends TaskParser implements Reporter { c.bold(c.yellow(` ${F_POINTER} `)) + formatProjectName(testFile.projectName) + testFile.filename - + c.dim(` ${testFile.completed}/${testFile.total}`), + + c.dim(!testFile.completed && !testFile.total + ? ' [queued]' + : ` ${testFile.completed}/${testFile.total}`), ) const slowTasks = [ diff --git a/packages/vitest/src/node/reporters/task-parser.ts b/packages/vitest/src/node/reporters/task-parser.ts index 54d517ec962f..7ff04f178f76 100644 --- a/packages/vitest/src/node/reporters/task-parser.ts +++ b/packages/vitest/src/node/reporters/task-parser.ts @@ -39,7 +39,7 @@ export class TaskParser { const task = this.ctx.state.idMap.get(pack[0]) if (task?.type === 'suite' && 'filepath' in task && task.result?.state) { - if (task?.result?.state === 'run') { + if (task?.result?.state === 'run' || task?.result?.state === 'queued') { startingTestFiles.push(task) } else { @@ -55,7 +55,7 @@ export class TaskParser { } if (task?.type === 'test') { - if (task.result?.state === 'run') { + if (task.result?.state === 'run' || task.result?.state === 'queued') { startingTests.push(task) } else if (task.result?.hooks?.afterEach !== 'run') { @@ -65,7 +65,7 @@ export class TaskParser { if (task?.result?.hooks) { for (const [hook, state] of Object.entries(task.result.hooks)) { - if (state === 'run') { + if (state === 'run' || state === 'queued') { startingHooks.push({ name: hook, file: task.file, id: task.id, type: task.type }) } else { @@ -81,7 +81,6 @@ export class TaskParser { startingTestFiles.forEach(file => this.onTestFilePrepare(file)) startingTests.forEach(test => this.onTestStart(test)) - startingHooks.forEach(hook => this.onHookStart(hook), - ) + startingHooks.forEach(hook => this.onHookStart(hook)) } } diff --git a/packages/vitest/src/node/reporters/verbose.ts b/packages/vitest/src/node/reporters/verbose.ts index dff3fbf168b1..8b2c03f6a974 100644 --- a/packages/vitest/src/node/reporters/verbose.ts +++ b/packages/vitest/src/node/reporters/verbose.ts @@ -20,6 +20,7 @@ export class VerboseReporter extends DefaultReporter { && task.type === 'test' && task.result?.state && task.result?.state !== 'run' + && task.result?.state !== 'queued' ) { let title = ` ${getStateSymbol(task)} ` if (task.file.projectName) { diff --git a/packages/vitest/src/node/types/browser.ts b/packages/vitest/src/node/types/browser.ts index 19e2b9f2a6df..8ff550fbca6d 100644 --- a/packages/vitest/src/node/types/browser.ts +++ b/packages/vitest/src/node/types/browser.ts @@ -3,7 +3,7 @@ import type { Awaitable, ErrorWithDiff, ParsedStack } from '@vitest/utils' import type { StackTraceParserOptions } from '@vitest/utils/source-map' import type { ViteDevServer } from 'vite' import type { TestProject } from '../project' -import type { ApiConfig } from './config' +import type { ApiConfig, ProjectConfig } from './config' export interface BrowserProviderInitializationOptions { browser: string @@ -26,9 +26,9 @@ export interface BrowserProvider { getSupportedBrowsers: () => readonly string[] beforeCommand?: (command: string, args: unknown[]) => Awaitable afterCommand?: (command: string, args: unknown[]) => Awaitable - getCommandsContext: (contextId: string) => Record - openPage: (contextId: string, url: string, beforeNavigate?: () => Promise) => Promise - getCDPSession?: (contextId: string) => Promise + getCommandsContext: (sessionId: string) => Record + openPage: (sessionId: string, url: string, beforeNavigate?: () => Promise) => Promise + getCDPSession?: (sessionId: string) => Promise close: () => Awaitable // eslint-disable-next-line ts/method-signature-style -- we want to allow extended options initialize( @@ -45,6 +45,44 @@ export interface BrowserProviderOptions {} export type BrowserBuiltinProvider = 'webdriverio' | 'playwright' | 'preview' +type UnsupportedProperties = + | 'browser' + | 'typecheck' + | 'alias' + | 'sequence' + | 'root' + | 'pool' + | 'poolOptions' + // browser mode doesn't support a custom runner + | 'runner' + // non-browser options + | 'api' + | 'deps' + | 'testTransformMode' + | 'poolMatchGlobs' + | 'environmentMatchGlobs' + | 'environment' + | 'environmentOptions' + | 'server' + | 'benchmark' + +export interface BrowserInstanceOption extends BrowserProviderOptions, + Omit, + Pick< + BrowserConfigOptions, + | 'headless' + | 'locators' + | 'viewport' + | 'testerHtmlPath' + | 'screenshotDirectory' + | 'screenshotFailures' + > { + /** + * Name of the browser + */ + browser: string +} + export interface BrowserConfigOptions { /** * if running tests in the browser should be the default @@ -55,8 +93,14 @@ export interface BrowserConfigOptions { /** * Name of the browser + * @deprecated use `configs` instead. if both are defined, this will filter `configs` by name. */ - name: string + name?: string + + /** + * Configurations for different browser setups + */ + instances?: BrowserInstanceOption[] /** * Browser provider @@ -74,6 +118,7 @@ export interface BrowserConfigOptions { * * @example * { playwright: { launch: { devtools: true } } + * @deprecated use `configs` instead */ providerOptions?: BrowserProviderOptions @@ -175,18 +220,28 @@ export interface BrowserConfigOptions { * @see {@link https://vitest.dev/guide/browser/commands} */ commands?: Record> + + /** + * Timeout for connecting to the browser + * @default 30000 + */ + connectTimeout?: number } export interface BrowserCommandContext { testPath: string | undefined provider: BrowserProvider project: TestProject + /** @deprecated use `sessionId` instead */ contextId: string + sessionId: string } -export interface BrowserServerStateContext { +export interface BrowserServerStateSession { files: string[] method: 'run' | 'collect' + project: TestProject + connected: () => void resolve: () => void reject: (v: unknown) => void } @@ -199,16 +254,18 @@ export interface BrowserOrchestrator { export interface BrowserServerState { orchestrators: Map - getContext: (contextId: string) => BrowserServerStateContext | undefined - createAsyncContext: (method: 'collect' | 'run', contextId: string, files: string[]) => Promise } -export interface BrowserServer { +export interface ParentProjectBrowser { + spawn: (project: TestProject) => ProjectBrowser +} + +export interface ProjectBrowser { vite: ViteDevServer state: BrowserServerState provider: BrowserProvider close: () => Promise - initBrowserProvider: () => Promise + initBrowserProvider: (project: TestProject) => Promise parseStacktrace: (stack: string) => ParsedStack[] parseErrorStacktrace: (error: ErrorWithDiff, options?: StackTraceParserOptions) => ParsedStack[] } @@ -247,6 +304,8 @@ export interface BrowserScript { } export interface ResolvedBrowserOptions extends BrowserConfigOptions { + name: string + providerOptions?: BrowserProviderOptions enabled: boolean headless: boolean isolate: boolean diff --git a/packages/vitest/src/node/types/config.ts b/packages/vitest/src/node/types/config.ts index 0ae7b73db302..6e3ddbd85302 100644 --- a/packages/vitest/src/node/types/config.ts +++ b/packages/vitest/src/node/types/config.ts @@ -25,7 +25,7 @@ import type { Reporter } from './reporter' export type { CoverageOptions, ResolvedCoverageOptions } export type { BenchmarkUserOptions } export type { RuntimeConfig, SerializedConfig } from '../../runtime/config' -export type { BrowserConfigOptions, BrowserScript } from './browser' +export type { BrowserConfigOptions, BrowserInstanceOption, BrowserScript } from './browser' export type { CoverageIstanbulOptions, CoverageV8Options } from './coverage' export type { SequenceHooks, SequenceSetupFiles } from '@vitest/runner' @@ -1081,14 +1081,16 @@ type NonProjectOptions = | 'maxWorkers' | 'minWorkers' | 'fileParallelism' + | 'workspace' export type ProjectConfig = Omit< - UserConfig, + InlineConfig, NonProjectOptions | 'sequencer' | 'deps' | 'poolOptions' > & { + mode?: string sequencer?: Omit deps?: Omit poolOptions?: { diff --git a/packages/vitest/src/node/types/reporter.ts b/packages/vitest/src/node/types/reporter.ts index efd8304d33c8..d45d6bf376a4 100644 --- a/packages/vitest/src/node/types/reporter.ts +++ b/packages/vitest/src/node/types/reporter.ts @@ -2,11 +2,13 @@ import type { File, TaskResultPack } from '@vitest/runner' import type { SerializedTestSpecification } from '../../runtime/types/utils' import type { Awaitable, UserConsoleLog } from '../../types/general' import type { Vitest } from '../core' +import type { TestModule } from '../reporters/reported-tasks' export interface Reporter { onInit?: (ctx: Vitest) => void onPathsCollected?: (paths?: string[]) => Awaitable onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable + onTestModuleQueued?: (file: TestModule) => Awaitable onCollected?: (files?: File[]) => Awaitable onFinished?: ( files: File[], diff --git a/packages/vitest/src/node/workspace/resolveWorkspace.ts b/packages/vitest/src/node/workspace/resolveWorkspace.ts index 765ce348eb4c..84451100456f 100644 --- a/packages/vitest/src/node/workspace/resolveWorkspace.ts +++ b/packages/vitest/src/node/workspace/resolveWorkspace.ts @@ -1,14 +1,17 @@ import type { Vitest } from '../core' -import type { TestProject } from '../project' -import type { TestProjectConfiguration, UserConfig, UserWorkspaceConfig } from '../types/config' +import type { BrowserInstanceOption, ResolvedConfig, TestProjectConfiguration, UserConfig, UserWorkspaceConfig } from '../types/config' import { existsSync, promises as fs } from 'node:fs' import os from 'node:os' import { limitConcurrency } from '@vitest/runner/utils' +import { deepClone, toArray } from '@vitest/utils' import fg from 'fast-glob' import { dirname, relative, resolve } from 'pathe' import { mergeConfig } from 'vite' import { configFiles as defaultConfigFiles } from '../../constants' -import { initializeProject } from '../project' +import { wildcardPatternToRegExp } from '../../utils/base' +import { isTTY } from '../../utils/env' +import { initializeProject, TestProject } from '../project' +import { withLabel } from '../reporters/renderers/utils' import { isDynamicPattern } from './fast-glob-pattern' export async function resolveWorkspace( @@ -97,7 +100,7 @@ export async function resolveWorkspace( // pretty rare case - the glob didn't match anything and there are no inline configs if (!projectPromises.length) { - return [vitest._ensureRootProject()] + return resolveBrowserWorkspace(vitest, new Set(), [vitest._ensureRootProject()]) } const resolvedProjects = await Promise.all(projectPromises) @@ -127,9 +130,157 @@ export async function resolveWorkspace( names.add(name) } + return resolveBrowserWorkspace(vitest, names, resolvedProjects) +} + +export async function resolveBrowserWorkspace( + vitest: Vitest, + names: Set, + resolvedProjects: TestProject[], +) { + const filters = toArray(vitest.config.project).map(s => wildcardPatternToRegExp(s)) + const removeProjects = new Set() + + resolvedProjects.forEach((project) => { + if (!project.config.browser.enabled) { + return + } + const configs = project.config.browser.instances || [] + if (configs.length === 0) { + // browser.name should be defined, otherwise the config fails in "resolveConfig" + configs.push({ browser: project.config.browser.name }) + console.warn( + withLabel( + 'yellow', + 'Vitest', + [ + `No browser "instances" were defined`, + project.name ? ` for the "${project.name}" project. ` : '. ', + `Running tests in "${project.config.browser.name}" browser. `, + 'The "browser.name" field is deprecated since Vitest 3. ', + 'Read more: https://vitest.dev/guide/browser/config#browser-instances', + ].filter(Boolean).join(''), + ), + ) + } + const originalName = project.config.name + const filteredConfigs = !filters.length + ? configs + : configs.filter((config) => { + const browser = config.browser + const newName = config.name || (originalName ? `${originalName} (${browser})` : browser) + return filters.some(pattern => pattern.test(newName)) + }) + + // every project was filtered out + if (!filteredConfigs.length) { + return + } + + if (project.config.browser.providerOptions) { + vitest.logger.warn( + withLabel('yellow', 'Vitest', `"providerOptions"${originalName ? ` in "${originalName}" project` : ''} is ignored because it's overriden by the configs. To hide this warning, remove the "providerOptions" property from the browser configuration.`), + ) + } + + filteredConfigs.forEach((config, index) => { + const browser = config.browser + if (!browser) { + const nth = index + 1 + const ending = nth === 2 ? 'nd' : nth === 3 ? 'rd' : 'th' + throw new Error(`The browser configuration must have a "browser" property. The ${nth}${ending} item in "browser.instances" doesn't have it. Make sure your${originalName ? ` "${originalName}"` : ''} configuration is correct.`) + } + const name = config.name + const newName = name || (originalName ? `${originalName} (${browser})` : browser) + + if (names.has(newName)) { + throw new Error( + [ + `Cannot define a nested project for a ${browser} browser. The project name "${newName}" was already defined. `, + 'If you have multiple instances for the same browser, make sure to define a custom "name". ', + 'All projects in a workspace should have unique names. Make sure your configuration is correct.', + ].join(''), + ) + } + names.add(newName) + const clonedConfig = cloneConfig(project, config) + clonedConfig.name = newName + const clone = TestProject._cloneBrowserProject(project, clonedConfig) + resolvedProjects.push(clone) + }) + + removeProjects.add(project) + }) + + resolvedProjects = resolvedProjects.filter(project => !removeProjects.has(project)) + + const headedBrowserProjects = resolvedProjects.filter((project) => { + return project.config.browser.enabled && !project.config.browser.headless + }) + if (headedBrowserProjects.length > 1) { + const message = [ + `Found multiple projects that run browser tests in headed mode: "${headedBrowserProjects.map(p => p.name).join('", "')}".`, + ` Vitest cannot run multiple headed browsers at the same time.`, + ].join('') + if (!isTTY) { + throw new Error(`${message} Please, filter projects with --browser=name or --project=name flag or run tests with "headless: true" option.`) + } + const prompts = await import('prompts') + const { projectName } = await prompts.default({ + type: 'select', + name: 'projectName', + choices: headedBrowserProjects.map(project => ({ + title: project.name, + value: project.name, + })), + message: `${message} Select a single project to run or cancel and run tests with "headless: true" option. Note that you can also start tests with --browser=name or --project=name flag.`, + }) + if (!projectName) { + throw new Error('The test run was aborted.') + } + return resolvedProjects.filter(project => project.name === projectName) + } + return resolvedProjects } +function cloneConfig(project: TestProject, { browser, ...config }: BrowserInstanceOption) { + const { + locators, + viewport, + testerHtmlPath, + headless, + screenshotDirectory, + screenshotFailures, + // @ts-expect-error remove just in case + browser: _browser, + name, + ...overrideConfig + } = config + const currentConfig = project.config.browser + return mergeConfig({ + ...deepClone(project.config), + browser: { + ...project.config.browser, + locators: locators + ? { + testIdAttribute: locators.testIdAttribute ?? currentConfig.locators.testIdAttribute, + } + : project.config.browser.locators, + viewport: viewport ?? currentConfig.viewport, + testerHtmlPath: testerHtmlPath ?? currentConfig.testerHtmlPath, + screenshotDirectory: screenshotDirectory ?? currentConfig.screenshotDirectory, + screenshotFailures: screenshotFailures ?? currentConfig.screenshotFailures, + // TODO: test that CLI arg is preferred over the local config + headless: project.vitest._options?.browser?.headless ?? headless ?? currentConfig.headless, + name: browser, + providerOptions: config, + instances: undefined, // projects cannot spawn more configs + }, + // TODO: should resolve, not merge/override + } satisfies ResolvedConfig, overrideConfig) as ResolvedConfig +} + async function resolveTestProjectConfigs( vitest: Vitest, workspaceConfigPath: string | undefined, diff --git a/packages/vitest/src/public/node.ts b/packages/vitest/src/public/node.ts index b85293dda07b..bc7fbcb502a4 100644 --- a/packages/vitest/src/public/node.ts +++ b/packages/vitest/src/public/node.ts @@ -13,6 +13,7 @@ export type { OnServerRestartHandler, OnTestsRerunHandler, Vitest, + VitestOptions, } from '../node/core' export { createVitest } from '../node/create' export { GitNotFoundError, FilesNotFoundError as TestsNotFoundError } from '../node/errors' @@ -60,16 +61,18 @@ export type { BrowserCommand, BrowserCommandContext, BrowserConfigOptions, + BrowserInstanceOption, BrowserOrchestrator, BrowserProvider, BrowserProviderInitializationOptions, BrowserProviderModule, BrowserProviderOptions, BrowserScript, - BrowserServer, BrowserServerState, - BrowserServerStateContext, + BrowserServerStateSession, CDPSession, + ParentProjectBrowser, + ProjectBrowser, ResolvedBrowserOptions, } from '../node/types/browser' /** @deprecated use `createViteServer` instead */ diff --git a/packages/vitest/src/runtime/runners/benchmark.ts b/packages/vitest/src/runtime/runners/benchmark.ts index d3d2a0be9fb1..59aa7ac7dc64 100644 --- a/packages/vitest/src/runtime/runners/benchmark.ts +++ b/packages/vitest/src/runtime/runners/benchmark.ts @@ -35,7 +35,7 @@ async function runBenchmarkSuite(suite: Suite, runner: NodeBenchmarkRunner) { const benchmarkGroup: Benchmark[] = [] const benchmarkSuiteGroup = [] for (const task of suite.tasks) { - if (task.mode !== 'run') { + if (task.mode !== 'run' && task.mode !== 'queued') { continue } diff --git a/packages/vitest/src/runtime/runners/index.ts b/packages/vitest/src/runtime/runners/index.ts index 2ac31beba3c7..66d0494fce74 100644 --- a/packages/vitest/src/runtime/runners/index.ts +++ b/packages/vitest/src/runtime/runners/index.ts @@ -68,6 +68,12 @@ export async function resolveTestRunner( return p } + const originalOnCollectStart = testRunner.onCollectStart + testRunner.onCollectStart = async (file) => { + await rpc().onQueued(file) + await originalOnCollectStart?.call(testRunner, file) + } + const originalOnCollected = testRunner.onCollected testRunner.onCollected = async (files) => { const state = getWorkerState() diff --git a/packages/vitest/src/runtime/runners/test.ts b/packages/vitest/src/runtime/runners/test.ts index b9b1cc106b7b..c660b632738a 100644 --- a/packages/vitest/src/runtime/runners/test.ts +++ b/packages/vitest/src/runtime/runners/test.ts @@ -91,7 +91,7 @@ export class VitestTestRunner implements VitestRunner { test.mode = 'skip' } - if (test.mode !== 'run') { + if (test.mode !== 'run' && test.mode !== 'queued') { return } diff --git a/packages/vitest/src/typecheck/collect.ts b/packages/vitest/src/typecheck/collect.ts index 4b1ae34ddfa1..075c739c1823 100644 --- a/packages/vitest/src/typecheck/collect.ts +++ b/packages/vitest/src/typecheck/collect.ts @@ -1,4 +1,4 @@ -import type { File, Suite, Test } from '@vitest/runner' +import type { File, RunMode, Suite, Test } from '@vitest/runner' import type { Node } from 'estree' import type { RawSourceMap } from 'vite-node' import type { TestProject } from '../node/project' @@ -32,7 +32,7 @@ interface LocalCallDefinition { end: number name: string type: 'suite' | 'test' - mode: 'run' | 'skip' | 'only' | 'todo' + mode: RunMode task: ParsedSuite | ParsedFile | ParsedTest } diff --git a/packages/vitest/src/typecheck/typechecker.ts b/packages/vitest/src/typecheck/typechecker.ts index 5b8710ee59d5..b52b255cbc1e 100644 --- a/packages/vitest/src/typecheck/typechecker.ts +++ b/packages/vitest/src/typecheck/typechecker.ts @@ -112,7 +112,7 @@ export class Typechecker { if ('tasks' in task) { markTasks(task.tasks) } - if (!task.result?.state && task.mode === 'run') { + if (!task.result?.state && (task.mode === 'run' || task.mode === 'queued')) { task.result = { state: 'pass', } diff --git a/packages/vitest/src/types/rpc.ts b/packages/vitest/src/types/rpc.ts index 5fd1f45c7687..cbdbbd9ef815 100644 --- a/packages/vitest/src/types/rpc.ts +++ b/packages/vitest/src/types/rpc.ts @@ -39,6 +39,7 @@ export interface RuntimeRPC { onPathsCollected: (paths: string[]) => void onUserConsoleLog: (log: UserConsoleLog) => void onUnhandledError: (err: unknown, type: string) => void + onQueued: (file: File) => void onCollected: (files: File[]) => Promise onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void onTaskUpdate: (pack: TaskResultPack[]) => Promise diff --git a/packages/vitest/src/utils/coverage.ts b/packages/vitest/src/utils/coverage.ts index 2d60ef22cc63..3fba42411c01 100644 --- a/packages/vitest/src/utils/coverage.ts +++ b/packages/vitest/src/utils/coverage.ts @@ -363,25 +363,54 @@ export class BaseCoverageProvider= 0) { const coverage = summary.data[thresholdKey].pct if (coverage < threshold) { process.exitCode = 1 - /* + /** * Generate error message based on perFile flag: * - ERROR: Coverage for statements (33.33%) does not meet threshold (85%) for src/math.ts * - ERROR: Coverage for statements (50%) does not meet global threshold (85%) */ - let errorMessage = `ERROR: Coverage for ${thresholdKey} (${coverage}%) does not meet ${ - name === GLOBAL_THRESHOLDS_KEY ? name : `"${name}"` + let errorMessage = `ERROR: Coverage for ${thresholdKey} (${coverage}%) does not meet ${name === GLOBAL_THRESHOLDS_KEY ? name : `"${name}"` } threshold (${threshold}%)` if (this.options.thresholds?.perFile && file) { errorMessage += ` for ${relative('./', file).replace(/\\/g, '/')}` } + this.ctx.logger.error(errorMessage) + } + } + else { + const uncovered = summary.data[thresholdKey].total - summary.data[thresholdKey].covered + const absoluteThreshold = threshold * -1 + + if (uncovered > absoluteThreshold) { + process.exitCode = 1 + + /** + * Generate error message based on perFile flag: + * - ERROR: Uncovered statements (33) exceed threshold (30) for src/math.ts + * - ERROR: Uncovered statements (33) exceed global threshold (30) + */ + let errorMessage = `ERROR: Uncovered ${thresholdKey} (${uncovered}) exceed ${name === GLOBAL_THRESHOLDS_KEY ? name : `"${name}"` + } threshold (${absoluteThreshold})` + + if (this.options.thresholds?.perFile && file) { + errorMessage += ` for ${relative('./', file).replace(/\\/g, '/')}` + } + this.ctx.logger.error(errorMessage) } } @@ -416,12 +445,30 @@ export class BaseCoverageProvider summary[key].pct), - ) + /** + * Positive thresholds are treated as minimum coverage percentages (X means: X% of lines must be covered), + * while negative thresholds are treated as maximum uncovered counts (-X means: X lines may be uncovered). + */ + if (threshold >= 0) { + const actual = Math.min( + ...summaries.map(summary => summary[key].pct), + ) - if (actual > threshold) { - thresholdsToUpdate.push([key, actual]) + if (actual > threshold) { + thresholdsToUpdate.push([key, actual]) + } + } + else { + const absoluteThreshold = threshold * -1 + const actual = Math.max( + ...summaries.map(summary => summary[key].total - summary[key].covered), + ) + + if (actual < absoluteThreshold) { + // If everything was covered, set new threshold to 100% (since a threshold of 0 would be considered as 0%) + const updatedThreshold = actual === 0 ? 100 : actual * -1 + thresholdsToUpdate.push([key, updatedThreshold]) + } } } diff --git a/packages/vitest/src/utils/env.ts b/packages/vitest/src/utils/env.ts index 4ecfcef7e29f..29b93231f66a 100644 --- a/packages/vitest/src/utils/env.ts +++ b/packages/vitest/src/utils/env.ts @@ -1,3 +1,5 @@ +import { isCI } from 'std-env' + export const isNode: boolean = typeof process < 'u' && typeof process.stdout < 'u' @@ -9,4 +11,5 @@ export const isDeno: boolean && process.versions?.deno !== undefined export const isWindows = (isNode || isDeno) && process.platform === 'win32' export const isBrowser: boolean = typeof window !== 'undefined' +export const isTTY: boolean = ((isNode || isDeno) && process.stdout?.isTTY && !isCI) export { isCI, provider as stdProvider } from 'std-env' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e3ee66946cff..c39719d8a27f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,20 +44,20 @@ importers: specifier: ^0.23.1 version: 0.23.1 '@playwright/test': - specifier: ^1.49.0 - version: 1.49.0 + specifier: ^1.49.1 + version: 1.49.1 '@rollup/plugin-commonjs': - specifier: ^28.0.1 - version: 28.0.1(rollup@4.28.1) + specifier: ^28.0.2 + version: 28.0.2(rollup@4.28.1) '@rollup/plugin-json': specifier: ^6.1.0 version: 6.1.0(rollup@4.28.1) '@rollup/plugin-node-resolve': - specifier: ^15.3.0 - version: 15.3.0(rollup@4.28.1) + specifier: ^15.3.1 + version: 15.3.1(rollup@4.28.1) '@types/node': - specifier: ^22.10.1 - version: 22.10.1 + specifier: ^22.10.2 + version: 22.10.2 '@types/ws': specifier: ^8.5.13 version: 8.5.13 @@ -74,8 +74,8 @@ importers: specifier: workspace:* version: link:packages/ui bumpp: - specifier: ^9.9.0 - version: 9.9.0(magicast@0.3.5) + specifier: ^9.9.1 + version: 9.9.1(magicast@0.3.5) changelogithub: specifier: ^0.13.11 version: 0.13.11(magicast@0.3.5) @@ -86,8 +86,8 @@ importers: specifier: ^9.16.0 version: 9.16.0(jiti@2.4.1) magic-string: - specifier: ^0.30.14 - version: 0.30.14 + specifier: ^0.30.17 + version: 0.30.17 pathe: specifier: ^1.1.2 version: 1.1.2 @@ -117,7 +117,7 @@ importers: version: 5.7.2 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:packages/vitest @@ -135,29 +135,29 @@ importers: version: 3.5.12(typescript@5.7.2) devDependencies: '@iconify-json/carbon': + specifier: ^1.2.5 + version: 1.2.5 + '@iconify-json/logos': specifier: ^1.2.4 version: 1.2.4 - '@iconify-json/logos': - specifier: ^1.2.3 - version: 1.2.3 '@shikijs/transformers': - specifier: ^1.24.2 - version: 1.24.2 + specifier: ^1.24.3 + version: 1.24.3 '@shikijs/vitepress-twoslash': - specifier: ^1.24.2 - version: 1.24.2(typescript@5.7.2) + specifier: ^1.24.3 + version: 1.24.3(typescript@5.7.2) '@unocss/reset': - specifier: ^0.65.1 - version: 0.65.1 + specifier: ^0.65.2 + version: 0.65.2 '@vite-pwa/assets-generator': specifier: ^0.2.6 version: 0.2.6 '@vite-pwa/vitepress': specifier: ^0.5.3 - version: 0.5.3(@vite-pwa/assets-generator@0.2.6)(vite-plugin-pwa@0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0)) + version: 0.5.3(@vite-pwa/assets-generator@0.2.6)(vite-plugin-pwa@0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0)) '@vitejs/plugin-vue': specifier: ^5.2.1 - version: 5.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + version: 5.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) https-localhost: specifier: ^4.7.1 version: 4.7.1 @@ -165,26 +165,26 @@ importers: specifier: ^0.2.10 version: 0.2.10 unocss: - specifier: ^0.65.1 - version: 0.65.1(postcss@8.4.49)(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + specifier: ^0.65.2 + version: 0.65.2(postcss@8.4.49)(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) unplugin-vue-components: - specifier: ^0.27.5 - version: 0.27.5(@babel/parser@7.26.2)(rollup@4.28.1)(vue@3.5.12(typescript@5.7.2)) + specifier: ^0.28.0 + version: 0.28.0(@babel/parser@7.26.2)(rollup@4.28.1)(vue@3.5.12(typescript@5.7.2)) vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vite-plugin-pwa: specifier: ^0.21.1 - version: 0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0) + version: 0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0) vitepress: specifier: ^1.5.0 - version: 1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.1)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2) + version: 1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.2)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2) vitepress-plugin-group-icons: specifier: ^1.3.1 version: 1.3.1 vitepress-plugin-tabs: specifier: ^0.5.0 - version: 0.5.0(vitepress@1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.1)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2))(vue@3.5.12(typescript@5.7.2)) + version: 0.5.0(vitepress@1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.2)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2))(vue@3.5.12(typescript@5.7.2)) workbox-window: specifier: ^7.3.0 version: 7.3.0 @@ -196,7 +196,7 @@ importers: version: link:../../packages/ui vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -217,7 +217,7 @@ importers: version: 4.7.2 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -248,7 +248,7 @@ importers: version: 1.49.0 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -257,7 +257,7 @@ importers: devDependencies: vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -266,10 +266,10 @@ importers: devDependencies: '@sveltejs/adapter-auto': specifier: ^2.1.0 - version: 2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))) + version: 2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))) '@sveltejs/kit': specifier: ^1.20.2 - version: 1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + version: 1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) svelte: specifier: ^3.59.1 version: 3.59.1 @@ -284,7 +284,7 @@ importers: version: 5.2.2 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -323,7 +323,7 @@ importers: version: 18.2.79 '@vitejs/plugin-react': specifier: ^4.2.1 - version: 4.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + version: 4.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) '@vitest/ui': specifier: workspace:* version: link:../../packages/ui @@ -344,7 +344,7 @@ importers: version: 4.7.2 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -364,11 +364,11 @@ importers: specifier: workspace:* version: link:../utils magic-string: - specifier: ^0.30.14 - version: 0.30.14 + specifier: ^0.30.17 + version: 0.30.17 msw: - specifier: ^2.6.8 - version: 2.6.8(@types/node@22.10.1)(typescript@5.7.2) + specifier: ^2.7.0 + version: 2.7.0(@types/node@22.10.2)(typescript@5.7.2) sirv: specifier: ^3.0.0 version: 3.0.0 @@ -407,8 +407,8 @@ importers: specifier: ^1.1.1 version: 1.1.1 mime: - specifier: ^4.0.4 - version: 4.0.4 + specifier: ^4.0.6 + version: 4.0.6 pathe: specifier: ^1.1.2 version: 1.1.2 @@ -416,11 +416,11 @@ importers: specifier: ^4.0.2 version: 4.0.2 playwright: - specifier: ^1.49.0 - version: 1.49.0 + specifier: ^1.49.1 + version: 1.49.1 playwright-core: - specifier: ^1.49.0 - version: 1.49.0 + specifier: ^1.49.1 + version: 1.49.1 safaridriver: specifier: ^1.0.0 version: 1.0.0 @@ -428,8 +428,8 @@ importers: specifier: workspace:* version: link:../vitest webdriverio: - specifier: ^8.40.6 - version: 8.40.6 + specifier: ^8.41.0 + version: 8.41.0 packages/coverage-istanbul: dependencies: @@ -516,8 +516,8 @@ importers: specifier: ^3.1.7 version: 3.1.7 magic-string: - specifier: ^0.30.14 - version: 0.30.14 + specifier: ^0.30.17 + version: 0.30.17 magicast: specifier: ^0.3.5 version: 0.3.5 @@ -599,8 +599,8 @@ importers: specifier: ^3.0.3 version: 3.0.3 magic-string: - specifier: ^0.30.14 - version: 0.30.14 + specifier: ^0.30.17 + version: 0.30.17 devDependencies: '@types/estree': specifier: ^1.0.6 @@ -612,14 +612,14 @@ importers: specifier: ^8.3.4 version: 8.3.4 msw: - specifier: ^2.6.8 - version: 2.6.8(@types/node@22.10.1)(typescript@5.7.2) + specifier: ^2.7.0 + version: 2.7.0(@types/node@22.10.2)(typescript@5.7.2) pathe: specifier: ^1.1.2 version: 1.1.2 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) packages/pretty-format: dependencies: @@ -652,8 +652,8 @@ importers: specifier: workspace:* version: link:../pretty-format magic-string: - specifier: ^0.30.14 - version: 0.30.14 + specifier: ^0.30.17 + version: 0.30.17 pathe: specifier: ^1.1.2 version: 1.1.2 @@ -705,11 +705,11 @@ importers: specifier: ^9.3.0 version: 9.3.0 '@iconify-json/carbon': + specifier: ^1.2.5 + version: 1.2.5 + '@iconify-json/logos': specifier: ^1.2.4 version: 1.2.4 - '@iconify-json/logos': - specifier: ^1.2.3 - version: 1.2.3 '@testing-library/vue': specifier: ^8.1.0 version: 8.1.0(@vue/compiler-sfc@3.5.13)(vue@3.5.12(typescript@5.7.2)) @@ -726,11 +726,11 @@ importers: specifier: ^8.5.13 version: 8.5.13 '@unocss/reset': - specifier: ^0.65.1 - version: 0.65.1 + specifier: ^0.65.2 + version: 0.65.2 '@vitejs/plugin-vue': specifier: ^5.2.1 - version: 5.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + version: 5.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) '@vitest/runner': specifier: workspace:* version: link:../runner @@ -768,20 +768,20 @@ importers: specifier: ^3.1.5 version: 3.1.5 unocss: - specifier: ^0.65.1 - version: 0.65.1(postcss@8.4.49)(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + specifier: ^0.65.2 + version: 0.65.2(postcss@8.4.49)(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) unplugin-auto-import: - specifier: ^0.18.6 - version: 0.18.6(@vueuse/core@12.0.0(typescript@5.7.2))(rollup@4.28.1) + specifier: ^0.19.0 + version: 0.19.0(@vueuse/core@12.0.0(typescript@5.7.2))(rollup@4.28.1) unplugin-vue-components: - specifier: ^0.27.5 - version: 0.27.5(@babel/parser@7.26.2)(rollup@4.28.1)(vue@3.5.12(typescript@5.7.2)) + specifier: ^0.28.0 + version: 0.28.0(@babel/parser@7.26.2)(rollup@4.28.1)(vue@3.5.12(typescript@5.7.2)) vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vite-plugin-pages: specifier: ^0.32.4 - version: 0.32.4(@vue/compiler-sfc@3.5.13)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue-router@4.5.0(vue@3.5.12(typescript@5.7.2))) + version: 0.32.4(@vue/compiler-sfc@3.5.13)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue-router@4.5.0(vue@3.5.12(typescript@5.7.2))) vue: specifier: ^3.5.12 version: 3.5.12(typescript@5.7.2) @@ -833,7 +833,7 @@ importers: version: 1.1.2 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) devDependencies: '@jridgewell/trace-mapping': specifier: ^0.3.25 @@ -884,8 +884,8 @@ importers: specifier: ^1.1.0 version: 1.1.0 magic-string: - specifier: ^0.30.14 - version: 0.30.14 + specifier: ^0.30.17 + version: 0.30.17 pathe: specifier: ^1.1.2 version: 1.1.2 @@ -906,7 +906,7 @@ importers: version: 1.2.0 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vite-node: specifier: workspace:* version: link:../vite-node @@ -945,8 +945,8 @@ importers: specifier: ^4.0.9 version: 4.0.9 '@types/node': - specifier: ^22.10.1 - version: 22.10.1 + specifier: ^22.10.2 + version: 22.10.2 '@types/prompts': specifier: ^2.4.9 version: 2.4.9 @@ -1059,7 +1059,7 @@ importers: version: 18.2.79 '@vitejs/plugin-basic-ssl': specifier: ^1.0.2 - version: 1.0.2(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + version: 1.0.2(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) '@vitest/browser': specifier: workspace:* version: link:../../packages/browser @@ -1104,7 +1104,7 @@ importers: version: 8.5.9 '@vitejs/plugin-basic-ssl': specifier: ^1.0.2 - version: 1.0.2(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + version: 1.0.2(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) '@vitest/runner': specifier: workspace:^ version: link:../../packages/runner @@ -1119,7 +1119,7 @@ importers: version: 1.4.4(@swc/core@1.4.1)(rollup@4.28.1) vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -1134,7 +1134,7 @@ importers: version: 0.3.0 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -1236,7 +1236,7 @@ importers: version: 3.0.3 '@vitejs/plugin-vue': specifier: latest - version: 5.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + version: 5.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) '@vitest/browser': specifier: workspace:* version: link:../../packages/browser @@ -1269,7 +1269,7 @@ importers: version: 1.4.4(@swc/core@1.4.1)(rollup@4.28.1) vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -1278,7 +1278,7 @@ importers: version: 3.5.12(typescript@5.7.2) webdriverio: specifier: latest - version: 9.4.1 + version: 9.4.5 test/dts-fixture: devDependencies: @@ -1359,7 +1359,7 @@ importers: version: 1.2.0 vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vite-node: specifier: workspace:* version: link:../../packages/vite-node @@ -1417,13 +1417,13 @@ importers: version: link:../../packages/browser vite: specifier: ^5.4.0 - version: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + version: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitest: specifier: workspace:* version: link:../../packages/vitest webdriverio: specifier: latest - version: 9.4.1 + version: 9.4.5 test/workspaces: devDependencies: @@ -3014,11 +3014,11 @@ packages: resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} engines: {node: '>=18.18'} - '@iconify-json/carbon@1.2.4': - resolution: {integrity: sha512-DhW2jjMVGwV0DLHc0cmDYohdtGxMra8UuwgjHrryPy+rQX4gXhJwCBBVP2h2UG/92AoRCTn7zUJve4WvY5MLYg==} + '@iconify-json/carbon@1.2.5': + resolution: {integrity: sha512-aI3TEzOrUDGhs74zIT3ym/ZQBUEziyu8JifntX2Hb4siVzsP5sQ/QEfVdmcCUj37kQUYT3TYBSeAw2vTfCJx9w==} - '@iconify-json/logos@1.2.3': - resolution: {integrity: sha512-JLHS5hgZP1b55EONAWNeqBUuriRfRNKWXK4cqYx0PpVaJfIIMiiMxFfvoQiX/bkE9XgkLhcKmDUqL3LXPdXPwQ==} + '@iconify-json/logos@1.2.4': + resolution: {integrity: sha512-XC4If5D/hbaZvUkTV8iaZuGlQCyG6CNOlaAaJaGa13V5QMYwYjgtKk3vPP8wz3wtTVNVEVk3LRx1fOJz+YnSMw==} '@iconify-json/simple-icons@1.2.11': resolution: {integrity: sha512-AHCGDtBRqP+JzAbBzgO8uN/08CXxEmuaC6lQQZ3b5burKhRU12AJnJczwbUw2K5Mb/U85EpSUNhYMG3F28b8NA==} @@ -3032,6 +3032,9 @@ packages: '@iconify/utils@2.1.33': resolution: {integrity: sha512-jP9h6v/g0BIZx0p7XGJJVtkVnydtbgTgt9mVNcGDYwaa7UhdHdI9dvoq+gKj9sijMSJKxUPEG2JyjsgXjxL7Kw==} + '@iconify/utils@2.2.1': + resolution: {integrity: sha512-0/7J7hk4PqXmxo5PDBDxmnecw5PxklZJfNjIVG9FM0mEfVrvfudS22rYWsqVk6gR3UJ/mSYS90X4R3znXnqfNA==} + '@inquirer/confirm@5.0.1': resolution: {integrity: sha512-6ycMm7k7NUApiMGfVc32yIPp28iPKxhGRMqoNDiUjq2RyTAkbs5Fx0TdzBqhabcKvniDdAAvHCmsRjnNfTsogw==} engines: {node: '>=18'} @@ -3145,8 +3148,8 @@ packages: resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@playwright/test@1.49.0': - resolution: {integrity: sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw==} + '@playwright/test@1.49.1': + resolution: {integrity: sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==} engines: {node: '>=18'} hasBin: true @@ -3192,8 +3195,8 @@ packages: '@types/babel__core': optional: true - '@rollup/plugin-commonjs@28.0.1': - resolution: {integrity: sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==} + '@rollup/plugin-commonjs@28.0.2': + resolution: {integrity: sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==} engines: {node: '>=16.0.0 || 14 >= 14.17'} peerDependencies: rollup: ^4.28.1 @@ -3210,8 +3213,8 @@ packages: rollup: optional: true - '@rollup/plugin-node-resolve@15.3.0': - resolution: {integrity: sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag==} + '@rollup/plugin-node-resolve@15.3.1': + resolution: {integrity: sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^4.28.1 @@ -3257,8 +3260,8 @@ packages: rollup: optional: true - '@rollup/pluginutils@5.1.2': - resolution: {integrity: sha512-/FIdS3PyZ39bjZlwqFnWqCOVnW7o963LtKMwQOD0NhQqw22gSr2YY1afu3FxRip4ZCZNsD5jq6Aaz6QV3D/Njw==} + '@rollup/pluginutils@5.1.3': + resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^4.28.1 @@ -3266,8 +3269,8 @@ packages: rollup: optional: true - '@rollup/pluginutils@5.1.3': - resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==} + '@rollup/pluginutils@5.1.4': + resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^4.28.1 @@ -3376,39 +3379,42 @@ packages: '@shikijs/core@1.22.2': resolution: {integrity: sha512-bvIQcd8BEeR1yFvOYv6HDiyta2FFVePbzeowf5pPS1avczrPK+cjmaxxh0nx5QzbON7+Sv0sQfQVciO7bN72sg==} - '@shikijs/core@1.24.2': - resolution: {integrity: sha512-BpbNUSKIwbKrRRA+BQj0BEWSw+8kOPKDJevWeSE/xIqGX7K0xrCZQ9kK0nnEQyrzsUoka1l81ZtJ2mGaCA32HQ==} + '@shikijs/core@1.24.3': + resolution: {integrity: sha512-VRcf4GYUIkxIchGM9DrapRcxtgojg4IWKUtX5EtW+4PJiGzF2xQqZSv27PJt+WLc18KT3CNLpNWow9JYV5n+Rg==} '@shikijs/engine-javascript@1.22.2': resolution: {integrity: sha512-iOvql09ql6m+3d1vtvP8fLCVCK7BQD1pJFmHIECsujB0V32BJ0Ab6hxk1ewVSMFA58FI0pR2Had9BKZdyQrxTw==} - '@shikijs/engine-javascript@1.24.2': - resolution: {integrity: sha512-EqsmYBJdLEwEiO4H+oExz34a5GhhnVp+jH9Q/XjPjmBPc6TE/x4/gD0X3i0EbkKKNqXYHHJTJUpOLRQNkEzS9Q==} + '@shikijs/engine-javascript@1.24.3': + resolution: {integrity: sha512-De8tNLvYjeK6V0Gb47jIH2M+OKkw+lWnSV1j3HVDFMlNIglmVcTMG2fASc29W0zuFbfEEwKjO8Fe4KYSO6Ce3w==} '@shikijs/engine-oniguruma@1.22.2': resolution: {integrity: sha512-GIZPAGzQOy56mGvWMoZRPggn0dTlBf1gutV5TdceLCZlFNqWmuc7u+CzD0Gd9vQUTgLbrt0KLzz6FNprqYAxlA==} - '@shikijs/engine-oniguruma@1.24.2': - resolution: {integrity: sha512-ZN6k//aDNWRJs1uKB12pturKHh7GejKugowOFGAuG7TxDRLod1Bd5JhpOikOiFqPmKjKEPtEA6mRCf7q3ulDyQ==} + '@shikijs/engine-oniguruma@1.24.3': + resolution: {integrity: sha512-iNnx950gs/5Nk+zrp1LuF+S+L7SKEhn8k9eXgFYPGhVshKppsYwRmW8tpmAMvILIMSDfrgqZ0w+3xWVQB//1Xw==} - '@shikijs/transformers@1.24.2': - resolution: {integrity: sha512-cIwn8YSwO3bsWKJ+pezcXY1Vq0BVwvuLes1TZSC5+Awi6Tsfqhf3vBahOIqZK1rraMKOti2VEAEF/95oXMig1w==} + '@shikijs/transformers@1.24.3': + resolution: {integrity: sha512-Zdu+pVZwQkUy/KWIVJFQlSqZGvPySU6oYZ2TsBKp3Ay5m1XzykPSeiaVvAh6LtyaXYDLeCdA3LjZfHyTXFjGTw==} - '@shikijs/twoslash@1.24.2': - resolution: {integrity: sha512-zcwYUNdSQDKquF1t+XrtoXM+lx9rCldAkZnT+e5fULKlLT6F8/F9fwICGhBm9lWp5/U4NptH+YcJUdvFOR0SRg==} + '@shikijs/twoslash@1.24.3': + resolution: {integrity: sha512-BlspJvcWJCz8tda7RP55eBi2TIzPn9T5wR3NVR0LdX7Itf8YcmOmj0Do1p/s5DdKFgCarzFG+wY+MT1nYk7new==} '@shikijs/types@1.22.2': resolution: {integrity: sha512-NCWDa6LGZqTuzjsGfXOBWfjS/fDIbDdmVDug+7ykVe1IKT4c1gakrvlfFYp5NhAXH/lyqLM8wsAPo5wNy73Feg==} - '@shikijs/types@1.24.2': - resolution: {integrity: sha512-bdeWZiDtajGLG9BudI0AHet0b6e7FbR0EsE4jpGaI0YwHm/XJunI9+3uZnzFtX65gsyJ6ngCIWUfA4NWRPnBkQ==} + '@shikijs/types@1.24.3': + resolution: {integrity: sha512-FPMrJ69MNxhRtldRk69CghvaGlbbN3pKRuvko0zvbfa2dXp4pAngByToqS5OY5jvN8D7LKR4RJE8UvzlCOuViw==} - '@shikijs/vitepress-twoslash@1.24.2': - resolution: {integrity: sha512-twOKyYay+ra3xBxbQhMIBM9Y3ZzZg18NAv529AL+r3p2kbDm7Lh623C9eSDsfZvWT9xCEZzaI6DEACT4YUPSuA==} + '@shikijs/vitepress-twoslash@1.24.3': + resolution: {integrity: sha512-H1okzdA8yYZqUFn3vEZLTskdjeUdCssrCRaBNN5+xCLkK9qxgtbH2l+UurISy5fShMySsAZE399CUZFq8J6u4Q==} '@shikijs/vscode-textmate@9.3.0': resolution: {integrity: sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==} + '@shikijs/vscode-textmate@9.3.1': + resolution: {integrity: sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==} + '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} @@ -3738,11 +3744,8 @@ packages: '@types/node@20.14.15': resolution: {integrity: sha512-Fz1xDMCF/B00/tYSVMlmK7hVeLh7jE5f3B7X1/hmV0MJBwE27KlS7EvD/Yp+z1lm8mVhwV5w+n8jOZG8AfTlKw==} - '@types/node@22.10.1': - resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} - - '@types/node@22.7.5': - resolution: {integrity: sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==} + '@types/node@22.10.2': + resolution: {integrity: sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==} '@types/normalize-package-data@2.4.1': resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -3922,83 +3925,83 @@ packages: '@ungap/structured-clone@1.2.1': resolution: {integrity: sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==} - '@unocss/astro@0.65.1': - resolution: {integrity: sha512-SnSoghbPWNC7Kxia/M0DuaYMcSmmeY7N54TYoNceQl23Ru2HioZvgjAJ+XtrK9B+Rvk+q9irGDTqhcadLVQ3Vg==} + '@unocss/astro@0.65.2': + resolution: {integrity: sha512-lpGoleJToxaYeN5LTGrNbvbXATNWswgoQwlljIJ9kWOjx4NbGC71pXRvDQSb9yRFDTCr5S2hMtupna4ulrHisA==} peerDependencies: vite: ^5.4.0 peerDependenciesMeta: vite: optional: true - '@unocss/cli@0.65.1': - resolution: {integrity: sha512-yV0n7+7hfxHtO+lXSElp8Zy2R5KM1ZVj9UWCemxQTJtKO+2KWk9HvGFR84Hs9+dno06GaOyQgpK1pBfmID0W0w==} + '@unocss/cli@0.65.2': + resolution: {integrity: sha512-N2SeSeGNNuWUQAtsOC02Uqhm1wCtyoRRmh8ylzA/NttbXJlqg5P03vxGfzmaRA+VJhNLwjFqhYE6Yuu4nqCwlg==} engines: {node: '>=14'} hasBin: true - '@unocss/config@0.65.1': - resolution: {integrity: sha512-Akf5Vm2bGrUK/a10QBF3GLETFJnwW1G8ThPevrOCj0lBVWKlN5eMQnodyNdoCw+JMPfCPZdg+4lU8cJJIRAAbQ==} + '@unocss/config@0.65.2': + resolution: {integrity: sha512-HDQVoWwrkZ6qRCXus11bUM12eNoErZ7r4lPY5EQqtrwxAcul+l5StvYk0qXr3IC8Ct42RDjKGeM03o7VBpwafQ==} engines: {node: '>=14'} - '@unocss/core@0.65.1': - resolution: {integrity: sha512-Ke0WNZjfSCE6pniJb8PjiwhO6/McxVb1EQYrkkz8aJuR83xu+AEcTog9D4N9EUkRfHS5tZYXQtTj4Uh90T6CEg==} + '@unocss/core@0.65.2': + resolution: {integrity: sha512-37zj1w/6TENsUMzRRmlH5LqUcLGTTjGHrUeZ5KZyeDk+osB/rHSCw0VqqqvL6a7cOHgaW88JgfgKDt5ijRZyFA==} - '@unocss/extractor-arbitrary-variants@0.65.1': - resolution: {integrity: sha512-VpF7j29TlmVjNolkIjhQ/cwYkuPUoXLv+ko62YRMibE5632QepbNob69pNYGOZustrZt3LvgHD/GcriKwJO4BA==} + '@unocss/extractor-arbitrary-variants@0.65.2': + resolution: {integrity: sha512-G+Fq7i2mTyFv+RdkbahGJFwUR9FbsGCHi+Wt8Eb7cbELWi/R4mUftfW9/q6NaIRKvmLywjWbEQ31qTJIQEO+PQ==} - '@unocss/inspector@0.65.1': - resolution: {integrity: sha512-RtONVp7rPpfSarr48qVEEsm201JyQSv6M21lqu1IzQZ62LQB5Gmi59Y+XR6cYDtwSn5ZUGxowR7nIRTPBMcxkw==} + '@unocss/inspector@0.65.2': + resolution: {integrity: sha512-90kBrMiQqHpGzPhT9ot7bDAFs+G9RxWROVxrT/JwDqNe+OmcLh5uETO84NU0ScurniEJ8umGBLqmsPGLmHML2g==} - '@unocss/postcss@0.65.1': - resolution: {integrity: sha512-k7mKObxE4o1gApICri20TpI0lT/dtEQv+uYEOrFz267jgPVo3VD6umHsTOLA+OoQ5Bf7VEYQXSeV0oA96j0o1w==} + '@unocss/postcss@0.65.2': + resolution: {integrity: sha512-vhBWsXnuWUP7qybnucle+gja1YBjL2NRfzCwSaOoRc7C5y201mqfC55AFqjGdxEAcqeeXVtx98Y1oh0FSa5GzA==} engines: {node: '>=14'} peerDependencies: postcss: ^8.4.21 - '@unocss/preset-attributify@0.65.1': - resolution: {integrity: sha512-bmu9JELcpwgrXA5RonvFeWb38RcUz82wpWfyDwKdQRJHD3MnYQ5lN03W4B7nMsAflc4ls7XQZLzhn9iYhbYYqg==} + '@unocss/preset-attributify@0.65.2': + resolution: {integrity: sha512-Aj67qbRoBPYutJasi7EKUaxKwJwEvhA0SVYjXwZG3kjTTBkp1rJvNI0wGXbdz9FkesymiC1KgzBF2UCsFsZ0dQ==} - '@unocss/preset-icons@0.65.1': - resolution: {integrity: sha512-lFGy4PpfClhiRV6Wwn4w79qd53B7QCkEmsP4YF2Px274X0t2av0QjMH+bvo6TrFIsHGKzq0Lxg836SoaPg5YJA==} + '@unocss/preset-icons@0.65.2': + resolution: {integrity: sha512-NruqU6PlRzyJT0qJQL3yZ/7KrolIWRfXQf82ZfAktPTHYgvaSS4+KtlStsoYSXLSGjPydMlXuYlj8Pum5rTTjw==} - '@unocss/preset-mini@0.65.1': - resolution: {integrity: sha512-dKIxi+ChWSZvXG8I7yVBjw4FLHdAvKrrCN9bjKpR4/4epKD6jRtEcR6S1wL6XSBWabh7V7D/VbVk+XZ6WsGuXA==} + '@unocss/preset-mini@0.65.2': + resolution: {integrity: sha512-zDDyFuLylmer91qeQ6qbMCP5+/zIeuZA0epLIriCfW3pR7FXzfJRu4R1ynpQjqryjUs/gwS0OWtvr4ufuwkryg==} - '@unocss/preset-tagify@0.65.1': - resolution: {integrity: sha512-u0yWFXyyBumglFvn87MT7kasa3KPAWTiIHkTCVu8tNEFNfJzR9BZLEXGAtwrhqMm0pSCnDdqupwBLBQoVX8zEA==} + '@unocss/preset-tagify@0.65.2': + resolution: {integrity: sha512-YFhne3eNfZUvKT/MJ7SgjK/FXLradgZCKc5XXsMXA4YTAhNAvQIUZCNmlBzaqDevwbyF6UlXxGHfHUA8CdpSWg==} - '@unocss/preset-typography@0.65.1': - resolution: {integrity: sha512-/fcgKU+uQ/RISRdJHTuSQh41Td/tAngSUzr+7Ry8f1UqI5NTjtGOixgfByPC+ZZ/V8f1DdjigaVy7Q3c+meUMg==} + '@unocss/preset-typography@0.65.2': + resolution: {integrity: sha512-k/uOu2ASnBQtotMBsx9pOmCgS+pyn7/4mCiifoeTTLnhMK8F6dcGLbVQkOnUD2hsboKXJ1oHgd+1qX0QVr61ww==} - '@unocss/preset-uno@0.65.1': - resolution: {integrity: sha512-OSEkphrlR9/RM5un9t9AqVQXOGBLJgjcEweZSm2ng9AK7BsxBXuVP1FelmRqeXVYT5uFtBoD4dfgCgBjGFIW9Q==} + '@unocss/preset-uno@0.65.2': + resolution: {integrity: sha512-8HA21mlXwnkXHhtSKYbBYJTmtJN0ncUPSJKiavNGkJUB4cUUbEeFRx2aNIfhOjKYIcH/MNzRc2YYsAAM2s6vgw==} - '@unocss/preset-web-fonts@0.65.1': - resolution: {integrity: sha512-29TO8kCfvOaHj5O3a3SZIXuOwvg7raPcdmuFKB9KFM3J2pYv4PB1cLBrw6h9DWwAAnJUSQpGx9QmKIBEPnDhlw==} + '@unocss/preset-web-fonts@0.65.2': + resolution: {integrity: sha512-Pl0sKjhrb6FuDID3PMwGflZXwSVW1G1vZEwCd0yEwYH92421VEfK5D073cUtZ1l6irqIA3aux9uMWA9iKtQj7A==} - '@unocss/preset-wind@0.65.1': - resolution: {integrity: sha512-7rw3hAWOkWMSjoprWKcQidqJRFQm8qM0IdLjFLQa2ROSzPSnIlNisXGEwAphf4/VYdP7+URUnu5eySQsIRWRzg==} + '@unocss/preset-wind@0.65.2': + resolution: {integrity: sha512-qNBJ6pnh9EYbTztmeJ+uZOB3TPx/JnQVHPGBBRD/v2AT11YR0/umdSKefIHbvXKuw/5/+JAwbFx/jSYu1naG6w==} - '@unocss/reset@0.65.1': - resolution: {integrity: sha512-qyxF7rKGX+Cu3FpV8KCRQbtCvFcBpmzvx5A2wal77tIhrFR5VSH7NzCVmgs2+V9FXvU3aWVNZ79i1KMnLZ5Mjg==} + '@unocss/reset@0.65.2': + resolution: {integrity: sha512-9UmwqYjfdxyi6j1pMfuulipLCsdH2RlF+IOG53unYxulP4C8bvwMnj8Wk+AjMiG5mIOClYyVTGk3NMRPM73/eg==} - '@unocss/rule-utils@0.65.1': - resolution: {integrity: sha512-XGXdXsRmIuMDQk/3Fd3g5JMhsyDGWsTfs6aN4vFQ1rfdSgY4UwbslqUNbIH9xxoTfmzUOJ2lhNrFw78RygCNSA==} + '@unocss/rule-utils@0.65.2': + resolution: {integrity: sha512-Rw+B52F53gli5wHRR4dXjFrliH6Q8XaNeg55L2uVmg81lEeQCdxPOe0/KjPIEPQPJHOhCpFS3dCHwNROc+UggQ==} engines: {node: '>=14'} - '@unocss/transformer-attributify-jsx@0.65.1': - resolution: {integrity: sha512-FR6pAnsHgflIumSl6Y5J+cWUtt2wNPANFWdGd1jNLpcBXDummEd0U+U9VGOfB8AOT263DW0U0JE7vH5xiwVaog==} + '@unocss/transformer-attributify-jsx@0.65.2': + resolution: {integrity: sha512-Kan2EPHc65t/iHdjqJvtRgc+lUnq2uSDknsTrOk+w1N/ZmjcbVf2E6VXbxBCqmHowJVipeHrxeVX1POyBm0bTQ==} - '@unocss/transformer-compile-class@0.65.1': - resolution: {integrity: sha512-yTs2u8bxGlTXEQ+XYFuS+kapLuLJr7yvNRRTg1hS+2OFdpT8E/PfxAgdGEzMfmrjommjF4BnJ8AAtK+Wsg5s4w==} + '@unocss/transformer-compile-class@0.65.2': + resolution: {integrity: sha512-z615DntK0bN0v3QicEGVmzt57yXXB20GhpOBTsShq/nTnTP0v+Av1JTbGQBSg8lzmW0z7QdLhCvSAQs8OKMmRQ==} - '@unocss/transformer-directives@0.65.1': - resolution: {integrity: sha512-6D3QSeSWXCA+Jc+BQGwat0RfcNtYZdyFFpP+zr1cFpK7nwNZqwqZU+mcY8nywu/u+hYuEQMWPMzEYDAssMfUQQ==} + '@unocss/transformer-directives@0.65.2': + resolution: {integrity: sha512-CwdjBoqWbX5FkJrt6Mpy6nBjppuQV2zvIma5W2rdd5XLsYeR0mhdbbQfgvRF94pFIR86ExfOKu/EI6bGuTcaHA==} - '@unocss/transformer-variant-group@0.65.1': - resolution: {integrity: sha512-LdSPDVpVCrMfgTKtGyWz0KkBXiJqFO8FRhiL4/9Hyaf+ECoWQ7RODgO6dKWyFIZEBjkLFK2toeZZvM+KYQlBlw==} + '@unocss/transformer-variant-group@0.65.2': + resolution: {integrity: sha512-Sh/WKN7lys2TUVnA3Nu7Yn3rLqy0OqfWSf6PbY1RKAD+N7cRlabu3vJF0gIMwV+rmVQnHs/k9BWjNPlB56Kl/A==} - '@unocss/vite@0.65.1': - resolution: {integrity: sha512-5242hAlgTVUA+tJ9mwo/cpLqD9f4dn5V/prTmtIci0Y7zMsVeBlnQwfsV4MhyTVaF3eFxDy5AUEFiOuXo12rbQ==} + '@unocss/vite@0.65.2': + resolution: {integrity: sha512-MC2PqDB2tbYky7s1XTBoOAdtvUIwwl65qL1UbHTLYiWO9Q704IZUYvrdtpgieR+8IPu2dG2vUyIe3dbD4zPf9g==} peerDependencies: vite: ^5.4.0 @@ -4292,12 +4295,12 @@ packages: resolution: {integrity: sha512-ubqe4X+TgcERzXKIpMfisquNxPZNtRU5uPeV7hvas++mD75QyNpmWHCtea2+TjoXKxlZd1MVrtZAwtmqMmyhPw==} engines: {node: ^16.13 || >=18} - '@wdio/config@8.40.6': - resolution: {integrity: sha512-rHCSmrhdJf7FlidcQPDvRKRPLYjklbrdxQa6J20BxHifTO4h2v23Wrq4OqqYIcq23gf9LpZvCA/PAMiET/QdVg==} + '@wdio/config@8.41.0': + resolution: {integrity: sha512-/6Z3sfSyhX5oVde0l01fyHimbqRYIVUDBnhDG2EMSCoC2lsaJX3Bm3IYpYHYHHFsgoDCi3B3Gv++t9dn2eSZZw==} engines: {node: ^16.13 || >=18} - '@wdio/config@9.2.8': - resolution: {integrity: sha512-EGMmBPGJbz6RmgMjebRWkWu3fGyeTIRcusF4UA4f2tiUEKY8nbzUO/ZyDjVQNR+YVB40q0jcqAqpszYRrIzzeg==} + '@wdio/config@9.4.4': + resolution: {integrity: sha512-w1Qo6QywLSGxmoglU4BiqDGNmFbwh/L6BRud4AO9nGgTuwKy6UkT7KevzlkIRiCHtdqkkjExR3xUi2OgjMdHAA==} engines: {node: '>=18.20.0'} '@wdio/logger@8.28.0': @@ -4308,8 +4311,8 @@ packages: resolution: {integrity: sha512-kcHL86RmNbcQP+Gq/vQUGlArfU6IIcbbnNp32rRIraitomZow+iEoc519rdQmSVusDozMS5DZthkgDdxK+vz6Q==} engines: {node: ^16.13 || >=18} - '@wdio/logger@9.1.3': - resolution: {integrity: sha512-cumRMK/gE1uedBUw3WmWXOQ7HtB6DR8EyKQioUz2P0IJtRRpglMBdZV7Svr3b++WWawOuzZHMfbTkJQmaVt8Gw==} + '@wdio/logger@9.4.4': + resolution: {integrity: sha512-BXx8RXFUW2M4dcO6t5Le95Hi2ZkTQBRsvBQqLekT2rZ6Xmw8ZKZBPf0FptnoftFGg6dYmwnDidYv/0+4PiHjpQ==} engines: {node: '>=18.20.0'} '@wdio/protocols@8.32.0': @@ -4318,8 +4321,8 @@ packages: '@wdio/protocols@8.40.3': resolution: {integrity: sha512-wK7+eyrB3TAei8RwbdkcyoNk2dPu+mduMBOdPJjp8jf/mavd15nIUXLID1zA+w5m1Qt1DsT1NbvaeO9+aJQ33A==} - '@wdio/protocols@9.2.2': - resolution: {integrity: sha512-0GMUSHCbYm+J+rnRU6XPtaUgVCRICsiH6W5zCXpePm3wLlbmg/mvZ+4OnNErssbpIOulZuAmC2jNmut2AEfWSw==} + '@wdio/protocols@9.4.4': + resolution: {integrity: sha512-IqbAWe5feY3xOwjbiW/2iwcbDU+nm5CX5Om835mxaNWqEoQiaZuTin4YgtgsPeSEBcSFtQ+2ooswr/6vIZdxSw==} '@wdio/repl@8.24.12': resolution: {integrity: sha512-321F3sWafnlw93uRTSjEBVuvWCxTkWNDs7ektQS15drrroL3TMeFOynu4rDrIz0jXD9Vas0HCD2Tq/P0uxFLdw==} @@ -4329,32 +4332,32 @@ packages: resolution: {integrity: sha512-mWEiBbaC7CgxvSd2/ozpbZWebnRIc8KRu/J81Hlw/txUWio27S7IpXBlZGVvhEsNzq0+cuxB/8gDkkXvMPbesw==} engines: {node: ^16.13 || >=18} - '@wdio/repl@9.0.8': - resolution: {integrity: sha512-3iubjl4JX5zD21aFxZwQghqC3lgu+mSs8c3NaiYYNCC+IT5cI/8QuKlgh9s59bu+N3gG988jqMJeCYlKuUv/iw==} + '@wdio/repl@9.4.4': + resolution: {integrity: sha512-kchPRhoG/pCn4KhHGiL/ocNhdpR8OkD2e6sANlSUZ4TGBVi86YSIEjc2yXUwLacHknC/EnQk/SFnqd4MsNjGGg==} engines: {node: '>=18.20.0'} '@wdio/types@8.32.2': resolution: {integrity: sha512-jq8LcBBQpBP9ZF5kECKEpXv8hN7irCGCjLFAN0Bd5ScRR6qu6MGWvwkDkau2sFPr0b++sKDCEaMzQlwrGFjZXg==} engines: {node: ^16.13 || >=18} - '@wdio/types@8.40.6': - resolution: {integrity: sha512-ALftLri1BdsRuPrQkuW3evBNdOA5n4IkuoegOw6UE2z+R0f1YI5fHGSHNRWLnhtbOECbGyHXXqzbSxCEb+o+MA==} + '@wdio/types@8.41.0': + resolution: {integrity: sha512-t4NaNTvJZci3Xv/yUZPH4eTL0hxrVTf5wdwNnYIBrzMnlRDbNefjQ0P7FM7ZjQCLaH92AEH6t/XanUId7Webug==} engines: {node: ^16.13 || >=18} - '@wdio/types@9.2.2': - resolution: {integrity: sha512-nHZ9Ne9iRQFJ1TOYKUn4Fza69IshTTzk6RYmSZ51ImGs9uMZu0+S0Jm9REdly+VLN3FzxG6g2QSe0/F3uNVPdw==} + '@wdio/types@9.4.4': + resolution: {integrity: sha512-Z2TAVMZiz4wCfP7ZdHqUXlYfF4qj5bBOV25A7tHxFbbdWPvFb8sSW3SU2+fxSwu02n5sV1mgfRYOsloypOXBnw==} engines: {node: '>=18.20.0'} '@wdio/utils@8.32.2': resolution: {integrity: sha512-PJcP4d1Fr8Zp+YIfGN93G0fjDj/6J0I6Gf6p0IpJk8qKQpdFDm4gB+lc202iv2YkyC+oT6b4Ik2W9LzvpSKNoQ==} engines: {node: ^16.13 || >=18} - '@wdio/utils@8.40.6': - resolution: {integrity: sha512-+TWfV6h+4f8gs7QiYUAWbWEylpZudQ+xkJPN34tRzPJK6dOBYEnIT/j6+1m3j39m1WPDehyYxIf1wCsrGKBxNQ==} + '@wdio/utils@8.41.0': + resolution: {integrity: sha512-0TcTjBiax1VxtJQ/iQA0ZyYOSHjjX2ARVmEI0AMo9+AuIq+xBfnY561+v8k9GqOMPKsiH/HrK3xwjx8xCVS03g==} engines: {node: ^16.13 || >=18} - '@wdio/utils@9.2.8': - resolution: {integrity: sha512-rKm5FXkpsCyeqh8tdirtRUHvgNytWNMiaVKdctsvKOJvqnDVPAAQcz9Wmgo7bSwoLwtSHcDaRoxY7olV7J4QnA==} + '@wdio/utils@9.4.4': + resolution: {integrity: sha512-CH2uHziYKZrm6xvI2Drfha+CBAK3cCHTFqhxfjP2dhz5kcCQfCEn22Bj12t2jYTILNvnxKFCxZyk+VEcQNMIKg==} engines: {node: '>=18.20.0'} '@yeger/debounce@2.0.10': @@ -4368,6 +4371,10 @@ packages: resolution: {integrity: sha512-J7cliimZ2snAbr0IhLx2U8BwfA1pKucahKzTpFtYq4hEgKxwvFJcIjCIVNPwQpfVab7iVP+AKmoH1gidBlyhiQ==} engines: {bun: '>=0.7.0', deno: '>=1.0.0', node: '>=16.5.0'} + '@zip.js/zip.js@2.7.54': + resolution: {integrity: sha512-qMrJVg2hoEsZJjMJez9yI2+nZlBUxgYzGV3mqcb2B/6T1ihXp0fWBDYlVHlHquuorgNUQP5a8qSmX6HF5rFJNg==} + engines: {bun: '>=0.7.0', deno: '>=1.0.0', node: '>=16.5.0'} + abbrev@2.0.0: resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -4703,8 +4710,8 @@ packages: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} engines: {node: '>=6'} - bumpp@9.9.0: - resolution: {integrity: sha512-d6Bv4O26po6gOrrjqDQte4+LxedxW885ZW7gJcNFUwkn9XH+8tKIB80za69SRluWkAgWPmSt7288pkMpzY1lnw==} + bumpp@9.9.1: + resolution: {integrity: sha512-M2CnokltfM7kLpYigS9PTAljG5pKng2MBTVpjCIXD+StNvhc+pnO+SYVnQDGjEVXD1fw2/Ofrf7wH45fxovoPg==} engines: {node: '>=10'} hasBin: true @@ -5099,8 +5106,8 @@ packages: css-shorthand-properties@1.1.1: resolution: {integrity: sha512-Md+Juc7M3uOdbAFwOYlTrccIZ7oCFuzrhKYQjdeUEW/sE1hv17Jp/Bws+ReOPpGVBTYCBoYo+G17V5Qo8QQ75A==} - css-tree@3.0.1: - resolution: {integrity: sha512-8Fxxv+tGhORlshCdCwnNJytvlvq46sOLSYEx2ZIGurahWvMucSRnyjPA3AmrMq4VPRYbHVpWj5VkiVasrM2H4Q==} + css-tree@3.1.0: + resolution: {integrity: sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} css-value@0.0.1: @@ -5445,6 +5452,11 @@ packages: resolution: {integrity: sha512-3Ve9cd5ziLByUdigw6zovVeWJjVs8QHVmqOB0sJ0WNeVPcwf4p18GnxMmVvlFmYRloUwf5suNuorea4QzwBIOA==} hasBin: true + edgedriver@6.1.1: + resolution: {integrity: sha512-/dM/PoBf22Xg3yypMWkmRQrBKEnSyNaZ7wHGCT9+qqT14izwtFT+QvdR89rjNkMfXwW+bSFoqOfbcvM+2Cyc7w==} + engines: {node: '>=18.0.0'} + hasBin: true + editorconfig@1.0.4: resolution: {integrity: sha512-L9Qe08KWTlqYMVvMcTIvMAdl1cDUubzRNYL+WfA4bLDMHe4nemKkpmYzkznE1FwLKu0EEmy6obgQKzMJrg4x9Q==} engines: {node: '>=14'} @@ -5899,6 +5911,10 @@ packages: resolution: {integrity: sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==} hasBin: true + fast-xml-parser@4.5.1: + resolution: {integrity: sha512-y655CeyUQ+jj7KBbYMc4FG01V8ZQqjN+gDYGJ50RtfsUB8iG9AmwmwoAgeKLJdmueKKMrH1RJ7yXHTSoczdv5w==} + hasBin: true + fastify@4.26.2: resolution: {integrity: sha512-90pjTuPGrfVKtdpLeLzND5nyC4woXZN5VadiNQCicj/iJU4viNHKhsAnb7jmv1vu2IzkLXyBiCzdWuzeXgQ5Ug==} @@ -5916,14 +5932,6 @@ packages: picomatch: optional: true - fdir@6.4.0: - resolution: {integrity: sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==} - peerDependencies: - picomatch: ^3 || ^4 - peerDependenciesMeta: - picomatch: - optional: true - fdir@6.4.2: resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} peerDependencies: @@ -6094,14 +6102,19 @@ packages: resolution: {integrity: sha512-Jh/AIwwgaxan+7ZUUmRLCjtchyDiqh4KjBJ5tW3plBZb5iL/BPcso8A5DlzeD9qlw0duCamnNdpFjxwaT0KyKg==} engines: {node: '>=14'} + geckodriver@4.2.1: + resolution: {integrity: sha512-4m/CRk0OI8MaANRuFIahvOxYTSjlNAO2p9JmE14zxueknq6cdtB5M9UGRQ8R9aMV0bLGNVHHDnDXmoXdOwJfWg==} + engines: {node: ^16.13 || >=18 || >=20} + hasBin: true + geckodriver@4.3.2: resolution: {integrity: sha512-TNOoy+ULXJWI5XOq7CXD3PAD9TJa4NjMe7nKUXjlIsf+vezuaRsFgPwcgYdEem1K7106wabYsqr7Kqn51g0sJg==} engines: {node: ^16.13 || >=18 || >=20} hasBin: true - geckodriver@4.4.3: - resolution: {integrity: sha512-79rvaq8pvKVUtuM9XBjQApb04kOVkl3TFRX+zTt1wlmL+wqpt85ocWCdqiENU/3zIzg2Me21eClUcnE7F1kL2w==} - engines: {node: ^16.13 || >=18 || >=20} + geckodriver@5.0.0: + resolution: {integrity: sha512-vn7TtQ3b9VMJtVXsyWtQQl1fyBVFhQy7UvJF96kPuuJ0or5THH496AD3eUyaDD11+EqCxH9t6V+EP9soZQk4YQ==} + engines: {node: '>=18.0.0'} hasBin: true gensync@1.0.0-beta.2: @@ -6316,6 +6329,9 @@ packages: hast-util-to-html@9.0.3: resolution: {integrity: sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==} + hast-util-to-html@9.0.4: + resolution: {integrity: sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==} + hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} @@ -6450,8 +6466,8 @@ packages: import-meta-resolve@4.0.0: resolution: {integrity: sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==} - importx@0.4.3: - resolution: {integrity: sha512-x6E6OxmWq/SUaj7wDeDeSjyHP+rMUbEaqJ5fw0uEtC/FTX9ocxNMFJ+ONnpJIsRpFz3ya6qJAK4orwSKqw0BSQ==} + importx@0.5.1: + resolution: {integrity: sha512-YrRaigAec1sC2CdIJjf/hCH1Wp9Ii8Cq5ROw4k5nJ19FVl2FcJUHZ5gGIb1vs8+JNYIyOJpc2fcufS2330bxDw==} imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} @@ -6769,10 +6785,6 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true - jiti@2.0.0-beta.2: - resolution: {integrity: sha512-c+PHQZakiQuMKbnhvrjZUvrK6E/AfmTOf4P+E3Y4FNVHcNMX9e/XrnbEvO+m4wS6ZjsvhHh/POQTlfy8uXFc0A==} - hasBin: true - jiti@2.4.1: resolution: {integrity: sha512-yPBThwecp1wS9DmoA4x4KR2h3QoslacnDR8ypuFM962kI4/456Iy1oHx2RAgh4jfZNdn0bctsdadceiBUgpU1g==} hasBin: true @@ -7050,8 +7062,8 @@ packages: magic-string@0.30.12: resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} - magic-string@0.30.14: - resolution: {integrity: sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==} + magic-string@0.30.17: + resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} magicast@0.3.3: resolution: {integrity: sha512-ZbrP1Qxnpoes8sz47AM0z08U+jW6TyRgZzcWy3Ma3vDhJttwMwAFDMMQFobwdBxByBD46JYmxRzeF7w2+wJEuw==} @@ -7105,8 +7117,8 @@ packages: mdast-util-to-string@4.0.0: resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==} - mdn-data@2.12.1: - resolution: {integrity: sha512-rsfnCbOHjqrhWxwt5/wtSLzpoKTzW7OXdT5lLOIH1OTYhWu9rRJveGq0sKvDZODABH7RX+uoR+DYcpFnq4Tf6Q==} + mdn-data@2.12.2: + resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==} media-typer@0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} @@ -7241,8 +7253,8 @@ packages: engines: {node: '>=10.0.0'} hasBin: true - mime@4.0.4: - resolution: {integrity: sha512-v8yqInVjhXyqP6+Kw4fV3ZzeMRqEW6FotRsKXjRS5VMTNIuXsdRoAvklpoRgSqXm6o9VNH4/C0mgedko9DdLsQ==} + mime@4.0.6: + resolution: {integrity: sha512-4rGt7rvQHBbaSOF9POGkk1ocRP16Md1x36Xma8sz8h8/vfCUI2OtEIeCqe4Ofes853x4xDoPiFLIT47J5fI/7A==} engines: {node: '>=16'} hasBin: true @@ -7366,8 +7378,8 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - msw@2.6.8: - resolution: {integrity: sha512-nxXxnH6WALZ9a7rsQp4HU2AaD4iGAiouMmE/MY4al7pXTibgA6OZOuKhmN2WBIM6w9qMKwRtX8p2iOb45B2M/Q==} + msw@2.7.0: + resolution: {integrity: sha512-BIodwZ19RWfCbYTxWTUfTXc+sg4OwjCAgxU1ZsgmggX/7S3LdUifsbUPJs61j0rWb19CZRGY5if77duhc0uXzw==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -7552,8 +7564,8 @@ packages: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} - oniguruma-to-es@0.7.0: - resolution: {integrity: sha512-HRaRh09cE0gRS3+wi2zxekB+I5L8C/gN60S+vb11eADHUaB/q4u8wGGOX3GvwvitG8ixaeycZfeoyruKQzUgNg==} + oniguruma-to-es@0.8.0: + resolution: {integrity: sha512-rY+/a6b+uCgoYIL9itjY0x99UUDHXmGaw7Jjk5ZvM/3cxDJifyxFr/Zm4tTmF6Tre18gAakJo7AzhKUeMNLgHA==} oniguruma-to-js@0.4.3: resolution: {integrity: sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==} @@ -7765,11 +7777,21 @@ packages: engines: {node: '>=18'} hasBin: true + playwright-core@1.49.1: + resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==} + engines: {node: '>=18'} + hasBin: true + playwright@1.49.0: resolution: {integrity: sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==} engines: {node: '>=18'} hasBin: true + playwright@1.49.1: + resolution: {integrity: sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==} + engines: {node: '>=18'} + hasBin: true + pluralize@8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} @@ -8032,8 +8054,8 @@ packages: regenerator-transform@0.15.2: resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} - regex-recursion@4.3.0: - resolution: {integrity: sha512-5LcLnizwjcQ2ALfOj95MjcatxyqF5RPySx9yT+PaXu3Gox2vyAtLDjHB8NTJLtMGkvyau6nI3CfpwFCjPUIs/A==} + regex-recursion@5.0.0: + resolution: {integrity: sha512-UwyOqeobrCCqTXPcsSqH4gDhOjD5cI/b8kjngWgSZbxYh5yVjAwTjO5+hAuPRNiuR70+5RlWSs+U9PVcVcW9Lw==} regex-utilities@2.3.0: resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==} @@ -8342,8 +8364,8 @@ packages: shiki@1.22.2: resolution: {integrity: sha512-3IZau0NdGKXhH2bBlUk4w1IHNxPh6A5B2sUpyY+8utLu2j/h1QpFkAaUA1bAMxOWWGtTWcAh531vnS4NJKS/lA==} - shiki@1.24.2: - resolution: {integrity: sha512-TR1fi6mkRrzW+SKT5G6uKuc32Dj2EEa7Kj0k8kGqiBINb+C1TiflVOiT9ta6GqOJtC4fraxO5SLUaKBcSY38Fg==} + shiki@1.24.3: + resolution: {integrity: sha512-eMeX/ehE2IDKVs71kB4zVcDHjutNcOtm+yIRuR4sA6ThBbdFI0DffGJiyoKCodj0xRGxIoWC3pk/Anmm5mzHmA==} side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} @@ -8375,10 +8397,6 @@ packages: resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} engines: {node: '>= 10'} - sirv@2.0.4: - resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} - engines: {node: '>= 10'} - sirv@3.0.0: resolution: {integrity: sha512-BPwJGUeDaDCHihkORDchNyyTvWFhcusy1XMmhEVTQTwGeybFbp8YEmB+njbPnth1FibULBSBVwCQni25XlCUDg==} engines: {node: '>=18'} @@ -8522,9 +8540,6 @@ packages: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} engines: {node: '>=10.0.0'} - streamx@2.15.1: - resolution: {integrity: sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==} - streamx@2.20.1: resolution: {integrity: sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==} @@ -9009,15 +9024,12 @@ packages: unconfig@0.3.11: resolution: {integrity: sha512-bV/nqePAKv71v3HdVUn6UefbsDKQWRX+bJIkiSm0+twIds6WiD2bJLWWT3i214+J/B4edufZpG2w7Y63Vbwxow==} - unconfig@0.5.5: - resolution: {integrity: sha512-VQZ5PT9HDX+qag0XdgQi8tJepPhXiR/yVOkn707gJDKo31lGjRilPREiQJ9Z6zd/Ugpv6ZvO5VxVIcatldYcNQ==} + unconfig@0.6.0: + resolution: {integrity: sha512-4C67J0nIF2QwSXty2kW3zZx1pMZ3iXabylvJWWgHybWVUcMf9pxwsngoQt0gC+AVstRywFqrRBp3qOXJayhpOw==} undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - undici-types@6.20.0: resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} @@ -9053,8 +9065,8 @@ packages: resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} engines: {node: '>=18'} - unimport@3.14.3: - resolution: {integrity: sha512-yEJps4GW7jBdoQlxEV0ElBCJsJmH8FdZtk4oog0y++8hgLh0dGnDpE4oaTc0Lfx4N5rRJiGFUWHrBqC8CyUBmQ==} + unimport@3.14.5: + resolution: {integrity: sha512-tn890SwFFZxqaJSKQPPd+yygfKSATbM8BZWW1aCR2TJBTs1SDrmLamBueaFtYsGjHtQaRgqEbQflOjN2iW12gA==} unique-string@2.0.0: resolution: {integrity: sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==} @@ -9087,11 +9099,11 @@ packages: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} - unocss@0.65.1: - resolution: {integrity: sha512-WK8EZlduulTcy2i1O4/hVPIYlgcztMbOqsIrxY18Hx1LXSkI5LgTl0FVEyf+xLcwqoUzt4VH2BWEEkzQ13+GAg==} + unocss@0.65.2: + resolution: {integrity: sha512-PEN8Yltr/n6xdNcI9iqIK4Dp/fpQ1bPa4aR2TwFg2lV6aRA2PNzarviqL62oOqXYSyQ4sqW3s/oaWD3JGOgJ1A==} engines: {node: '>=14'} peerDependencies: - '@unocss/webpack': 0.65.1 + '@unocss/webpack': 0.65.2 vite: ^5.4.0 peerDependenciesMeta: '@unocss/webpack': @@ -9103,8 +9115,8 @@ packages: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} - unplugin-auto-import@0.18.6: - resolution: {integrity: sha512-LMFzX5DtkTj/3wZuyG5bgKBoJ7WSgzqSGJ8ppDRdlvPh45mx6t6w3OcbExQi53n3xF5MYkNGPNR/HYOL95KL2A==} + unplugin-auto-import@0.19.0: + resolution: {integrity: sha512-W97gTDEWu/L1EcKCXY5Ni8bsMW1E9kv12wYQv3mYpd7zcFctXYlLKsqeva6sbCQbzS8t9AG/XdU5/WkEJKPlFw==} engines: {node: '>=14'} peerDependencies: '@nuxt/kit': ^3.2.2 @@ -9120,8 +9132,8 @@ packages: peerDependencies: '@swc/core': ^1.2.108 - unplugin-vue-components@0.27.5: - resolution: {integrity: sha512-m9j4goBeNwXyNN8oZHHxvIIYiG8FQ9UfmKWeNllpDvhU7btKNNELGPt+o3mckQKuPwrE7e0PvCsx+IWuDSD9Vg==} + unplugin-vue-components@0.28.0: + resolution: {integrity: sha512-jiTGtJ3JsRFBjgvyilfrX7yUoGKScFgbdNw+6p6kEXU+Spf/rhxzgvdfuMcvhCcLmflB/dY3pGQshYBVGOUx7Q==} engines: {node: '>=14'} peerDependencies: '@babel/parser': ^7.15.8 @@ -9140,6 +9152,10 @@ packages: unplugin@1.7.1: resolution: {integrity: sha512-JqzORDAPxxs8ErLV4x+LL7bk5pk3YlcWqpSNsIkAZj972KzFZLClc/ekppahKkOczGkwIG6ElFgdOgOlK4tXZw==} + unplugin@2.1.0: + resolution: {integrity: sha512-us4j03/499KhbGP8BU7Hrzrgseo+KdfJYWcbcajCOqsAyb8Gk0Yn2kiUIcZISYCb1JFaZfIuG3b42HmguVOKCQ==} + engines: {node: '>=18.12.0'} + untildify@4.0.0: resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==} engines: {node: '>=8'} @@ -9445,12 +9461,12 @@ packages: resolution: {integrity: sha512-uyCT2QzCqoz+EsMLTApG5/+RvHJR9MVbdEnjMoxpJDt+IeZCG2Vy/Gq9oNgNQfpxrvZme/EY+PtBsltZi7BAyg==} engines: {node: ^16.13 || >=18} - webdriver@8.40.6: - resolution: {integrity: sha512-jkslwUvOmqhFfc1E21Tz48NgYD8ykiR+09iWZlVLtx3P43k4jOfS+CfasvQ+6hJiVck+N5dXjYfg6zDjpkIFRw==} + webdriver@8.41.0: + resolution: {integrity: sha512-n8OrFnVT4hAaGa0Advr3T8ObJdeKNTRklHIEzM2CYVx/5DZt+2KwaKSxWsURNd4zU7FbsfaJUU4rQWCmvozQLg==} engines: {node: ^16.13 || >=18} - webdriver@9.4.1: - resolution: {integrity: sha512-vFDdxMj/9W1+6jhpHSiRYfO8dix23HjAUtLx7aOv9ejEsntC0EzCIAftJ59YsF3Ppu184+FkdDVhnivpkZPTFw==} + webdriver@9.4.4: + resolution: {integrity: sha512-F/QxX3TNfkBWzYC0Ywz0oRRUtvUEFUM59pob19gs+lZ2seXKKCJ8vVLzIWcT9XBU8dFAWN6Mzqi5FypHWeBgfw==} engines: {node: '>=18.20.0'} webdriverio@8.32.2: @@ -9462,8 +9478,8 @@ packages: devtools: optional: true - webdriverio@8.40.6: - resolution: {integrity: sha512-hMFYRjVU5Nnk2e9Mi8kDx/IVFMWGaVyDCDpv/SeXXCP17DT9jAZtOWlwGhRaLVikN5JYYuHavHyatVa7gj6QTg==} + webdriverio@8.41.0: + resolution: {integrity: sha512-WlQfw0mUEhTS8DPr+TBSYMhEnqXkFr2dcUwPb5XkffTB+i0wftf+BLXJPSVD9M1PTLyYcFdCIu68pqR54dq5BA==} engines: {node: ^16.13 || >=18} peerDependencies: devtools: ^8.14.0 @@ -9471,8 +9487,8 @@ packages: devtools: optional: true - webdriverio@9.4.1: - resolution: {integrity: sha512-XIPtRnxSES4CoxH2BfUY/6QzNgEgJEUjMYu7t7SJR8bVfbLRVXAA1ie9kM0MtdLs4oZ2Pr8rR8fqytsA1CjEWw==} + webdriverio@9.4.5: + resolution: {integrity: sha512-tc22NSwKbXNROhafzktoQnhfkx0bhvh9a+XVaVu3mLhaiOmymIGDcS2NyRoOn3Sq4JxWJuOUwTO6f6jNkFJ5bQ==} engines: {node: '>=18.20.0'} peerDependencies: puppeteer-core: ^22.3.0 @@ -9546,6 +9562,11 @@ packages: engines: {node: ^16.13.0 || >=18.0.0} hasBin: true + which@5.0.0: + resolution: {integrity: sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==} + engines: {node: ^18.17.0 || >=20.5.0} + hasBin: true + why-is-node-running@2.3.0: resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} engines: {node: '>=8'} @@ -11357,11 +11378,11 @@ snapshots: '@humanwhocodes/retry@0.4.1': {} - '@iconify-json/carbon@1.2.4': + '@iconify-json/carbon@1.2.5': dependencies: '@iconify/types': 2.0.0 - '@iconify-json/logos@1.2.3': + '@iconify-json/logos@1.2.4': dependencies: '@iconify/types': 2.0.0 @@ -11387,16 +11408,29 @@ snapshots: transitivePeerDependencies: - supports-color - '@inquirer/confirm@5.0.1(@types/node@22.10.1)': + '@iconify/utils@2.2.1': + dependencies: + '@antfu/install-pkg': 0.4.1 + '@antfu/utils': 0.7.10 + '@iconify/types': 2.0.0 + debug: 4.4.0 + globals: 15.13.0 + kolorist: 1.8.0 + local-pkg: 0.5.1 + mlly: 1.7.3 + transitivePeerDependencies: + - supports-color + + '@inquirer/confirm@5.0.1(@types/node@22.10.2)': dependencies: - '@inquirer/core': 10.0.1(@types/node@22.10.1) - '@inquirer/type': 3.0.0(@types/node@22.10.1) - '@types/node': 22.10.1 + '@inquirer/core': 10.0.1(@types/node@22.10.2) + '@inquirer/type': 3.0.0(@types/node@22.10.2) + '@types/node': 22.10.2 - '@inquirer/core@10.0.1(@types/node@22.10.1)': + '@inquirer/core@10.0.1(@types/node@22.10.2)': dependencies: '@inquirer/figures': 1.0.7 - '@inquirer/type': 3.0.0(@types/node@22.10.1) + '@inquirer/type': 3.0.0(@types/node@22.10.2) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -11409,9 +11443,9 @@ snapshots: '@inquirer/figures@1.0.7': {} - '@inquirer/type@3.0.0(@types/node@22.10.1)': + '@inquirer/type@3.0.0(@types/node@22.10.2)': dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 '@isaacs/cliui@8.0.2': dependencies: @@ -11438,7 +11472,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 22.10.1 + '@types/node': 22.10.2 '@types/yargs': 17.0.33 chalk: 4.1.2 optional: true @@ -11517,9 +11551,9 @@ snapshots: '@pkgr/core@0.1.1': {} - '@playwright/test@1.49.0': + '@playwright/test@1.49.1': dependencies: - playwright: 1.49.0 + playwright: 1.49.1 '@polka/url@1.0.0-next.24': {} @@ -11589,14 +11623,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@rollup/plugin-commonjs@28.0.1(rollup@4.28.1)': + '@rollup/plugin-commonjs@28.0.2(rollup@4.28.1)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.28.1) + '@rollup/pluginutils': 5.1.3(rollup@4.28.1) commondir: 1.0.1 estree-walker: 2.0.2 - fdir: 6.4.0(picomatch@4.0.2) + fdir: 6.4.2(picomatch@4.0.2) is-reference: 1.2.1 - magic-string: 0.30.14 + magic-string: 0.30.17 picomatch: 4.0.2 optionalDependencies: rollup: 4.28.1 @@ -11607,9 +11641,9 @@ snapshots: optionalDependencies: rollup: 4.28.1 - '@rollup/plugin-node-resolve@15.3.0(rollup@4.28.1)': + '@rollup/plugin-node-resolve@15.3.1(rollup@4.28.1)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.28.1) + '@rollup/pluginutils': 5.1.3(rollup@4.28.1) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 @@ -11654,15 +11688,15 @@ snapshots: optionalDependencies: rollup: 4.28.1 - '@rollup/pluginutils@5.1.2(rollup@4.28.1)': + '@rollup/pluginutils@5.1.3(rollup@4.28.1)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 - picomatch: 2.3.1 + picomatch: 4.0.2 optionalDependencies: rollup: 4.28.1 - '@rollup/pluginutils@5.1.3(rollup@4.28.1)': + '@rollup/pluginutils@5.1.4(rollup@4.28.1)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 @@ -11738,14 +11772,14 @@ snapshots: '@types/hast': 3.0.4 hast-util-to-html: 9.0.3 - '@shikijs/core@1.24.2': + '@shikijs/core@1.24.3': dependencies: - '@shikijs/engine-javascript': 1.24.2 - '@shikijs/engine-oniguruma': 1.24.2 - '@shikijs/types': 1.24.2 - '@shikijs/vscode-textmate': 9.3.0 + '@shikijs/engine-javascript': 1.24.3 + '@shikijs/engine-oniguruma': 1.24.3 + '@shikijs/types': 1.24.3 + '@shikijs/vscode-textmate': 9.3.1 '@types/hast': 3.0.4 - hast-util-to-html: 9.0.3 + hast-util-to-html: 9.0.4 '@shikijs/engine-javascript@1.22.2': dependencies: @@ -11753,30 +11787,30 @@ snapshots: '@shikijs/vscode-textmate': 9.3.0 oniguruma-to-js: 0.4.3 - '@shikijs/engine-javascript@1.24.2': + '@shikijs/engine-javascript@1.24.3': dependencies: - '@shikijs/types': 1.24.2 - '@shikijs/vscode-textmate': 9.3.0 - oniguruma-to-es: 0.7.0 + '@shikijs/types': 1.24.3 + '@shikijs/vscode-textmate': 9.3.1 + oniguruma-to-es: 0.8.0 '@shikijs/engine-oniguruma@1.22.2': dependencies: '@shikijs/types': 1.22.2 '@shikijs/vscode-textmate': 9.3.0 - '@shikijs/engine-oniguruma@1.24.2': + '@shikijs/engine-oniguruma@1.24.3': dependencies: - '@shikijs/types': 1.24.2 - '@shikijs/vscode-textmate': 9.3.0 + '@shikijs/types': 1.24.3 + '@shikijs/vscode-textmate': 9.3.1 - '@shikijs/transformers@1.24.2': + '@shikijs/transformers@1.24.3': dependencies: - shiki: 1.24.2 + shiki: 1.24.3 - '@shikijs/twoslash@1.24.2(typescript@5.7.2)': + '@shikijs/twoslash@1.24.3(typescript@5.7.2)': dependencies: - '@shikijs/core': 1.24.2 - '@shikijs/types': 1.24.2 + '@shikijs/core': 1.24.3 + '@shikijs/types': 1.24.3 twoslash: 0.2.12(typescript@5.7.2) transitivePeerDependencies: - supports-color @@ -11787,19 +11821,19 @@ snapshots: '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 - '@shikijs/types@1.24.2': + '@shikijs/types@1.24.3': dependencies: - '@shikijs/vscode-textmate': 9.3.0 + '@shikijs/vscode-textmate': 9.3.1 '@types/hast': 3.0.4 - '@shikijs/vitepress-twoslash@1.24.2(typescript@5.7.2)': + '@shikijs/vitepress-twoslash@1.24.3(typescript@5.7.2)': dependencies: - '@shikijs/twoslash': 1.24.2(typescript@5.7.2) + '@shikijs/twoslash': 1.24.3(typescript@5.7.2) floating-vue: 5.2.2(vue@3.5.13(typescript@5.7.2)) mdast-util-from-markdown: 2.0.2 mdast-util-gfm: 3.0.0 mdast-util-to-hast: 13.2.0 - shiki: 1.24.2 + shiki: 1.24.3 twoslash: 0.2.12(typescript@5.7.2) twoslash-vue: 0.2.12(typescript@5.7.2) vue: 3.5.13(typescript@5.7.2) @@ -11810,6 +11844,8 @@ snapshots: '@shikijs/vscode-textmate@9.3.0': {} + '@shikijs/vscode-textmate@9.3.1': {} + '@sinclair/typebox@0.27.8': {} '@sindresorhus/is@5.3.0': {} @@ -11843,14 +11879,14 @@ snapshots: magic-string: 0.25.9 string.prototype.matchall: 4.0.11 - '@sveltejs/adapter-auto@2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)))': + '@sveltejs/adapter-auto@2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)))': dependencies: - '@sveltejs/kit': 1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + '@sveltejs/kit': 1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) import-meta-resolve: 3.0.0 - '@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))': + '@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))': dependencies: - '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) '@types/cookie': 0.5.1 cookie: 0.5.0 devalue: 4.3.2 @@ -11864,30 +11900,30 @@ snapshots: svelte: 3.59.1 tiny-glob: 0.2.9 undici: 5.22.1 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte-inspector@1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)))(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))': + '@sveltejs/vite-plugin-svelte-inspector@1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)))(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))': dependencies: - '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) debug: 4.4.0 svelte: 3.59.1 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))': + '@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)))(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + '@sveltejs/vite-plugin-svelte-inspector': 1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)))(svelte@3.59.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) debug: 4.4.0 deepmerge: 4.3.1 kleur: 4.1.5 - magic-string: 0.30.14 + magic-string: 0.30.17 svelte: 3.59.1 svelte-hmr: 0.15.3(svelte@3.59.1) - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) - vitefu: 0.2.5(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) + vitefu: 0.2.5(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)) transitivePeerDependencies: - supports-color @@ -12102,7 +12138,7 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 22.10.1 + '@types/node': 22.10.2 optional: true '@types/fs-extra@8.1.3': @@ -12154,7 +12190,7 @@ snapshots: '@types/jsdom@21.1.7': dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 '@types/tough-cookie': 4.0.2 parse5: 7.1.2 @@ -12162,7 +12198,7 @@ snapshots: '@types/jsonfile@6.1.4': dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 optional: true '@types/linkify-it@5.0.0': {} @@ -12196,19 +12232,15 @@ snapshots: dependencies: undici-types: 5.26.5 - '@types/node@22.10.1': + '@types/node@22.10.2': dependencies: undici-types: 6.20.0 - '@types/node@22.7.5': - dependencies: - undici-types: 6.19.8 - '@types/normalize-package-data@2.4.1': {} '@types/prompts@2.4.9': dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 kleur: 3.0.3 '@types/prop-types@15.7.9': {} @@ -12281,7 +12313,7 @@ snapshots: '@types/yauzl@2.10.3': dependencies: - '@types/node': 20.14.15 + '@types/node': 22.10.2 optional: true '@typescript-eslint/eslint-plugin@8.17.0(@typescript-eslint/parser@8.17.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.7.2))(eslint@9.16.0(jiti@2.4.1))(typescript@5.7.2)': @@ -12413,30 +12445,30 @@ snapshots: '@ungap/structured-clone@1.2.1': {} - '@unocss/astro@0.65.1(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2))': + '@unocss/astro@0.65.2(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2))': dependencies: - '@unocss/core': 0.65.1 - '@unocss/reset': 0.65.1 - '@unocss/vite': 0.65.1(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + '@unocss/core': 0.65.2 + '@unocss/reset': 0.65.2 + '@unocss/vite': 0.65.2(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) optionalDependencies: - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) transitivePeerDependencies: - rollup - supports-color - vue - '@unocss/cli@0.65.1(rollup@4.28.1)': + '@unocss/cli@0.65.2(rollup@4.28.1)': dependencies: '@ampproject/remapping': 2.3.0 - '@rollup/pluginutils': 5.1.3(rollup@4.28.1) - '@unocss/config': 0.65.1 - '@unocss/core': 0.65.1 - '@unocss/preset-uno': 0.65.1 + '@rollup/pluginutils': 5.1.4(rollup@4.28.1) + '@unocss/config': 0.65.2 + '@unocss/core': 0.65.2 + '@unocss/preset-uno': 0.65.2 cac: 6.7.14(patch_hash=slh3cigivjjjktoa42g2agwaem) chokidar: 3.6.0 colorette: 2.0.20 consola: 3.2.3 - magic-string: 0.30.14 + magic-string: 0.30.17 pathe: 1.1.2 perfect-debounce: 1.0.0 tinyglobby: 0.2.10 @@ -12444,121 +12476,121 @@ snapshots: - rollup - supports-color - '@unocss/config@0.65.1': + '@unocss/config@0.65.2': dependencies: - '@unocss/core': 0.65.1 - unconfig: 0.5.5 + '@unocss/core': 0.65.2 + unconfig: 0.6.0 transitivePeerDependencies: - supports-color - '@unocss/core@0.65.1': {} + '@unocss/core@0.65.2': {} - '@unocss/extractor-arbitrary-variants@0.65.1': + '@unocss/extractor-arbitrary-variants@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 - '@unocss/inspector@0.65.1(vue@3.5.12(typescript@5.7.2))': + '@unocss/inspector@0.65.2(vue@3.5.12(typescript@5.7.2))': dependencies: - '@unocss/core': 0.65.1 - '@unocss/rule-utils': 0.65.1 + '@unocss/core': 0.65.2 + '@unocss/rule-utils': 0.65.2 gzip-size: 6.0.0 - sirv: 2.0.4 + sirv: 3.0.0 vue-flow-layout: 0.1.1(vue@3.5.12(typescript@5.7.2)) transitivePeerDependencies: - vue - '@unocss/postcss@0.65.1(postcss@8.4.49)': + '@unocss/postcss@0.65.2(postcss@8.4.49)': dependencies: - '@unocss/config': 0.65.1 - '@unocss/core': 0.65.1 - '@unocss/rule-utils': 0.65.1 - css-tree: 3.0.1 + '@unocss/config': 0.65.2 + '@unocss/core': 0.65.2 + '@unocss/rule-utils': 0.65.2 + css-tree: 3.1.0 postcss: 8.4.49 tinyglobby: 0.2.10 transitivePeerDependencies: - supports-color - '@unocss/preset-attributify@0.65.1': + '@unocss/preset-attributify@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 - '@unocss/preset-icons@0.65.1': + '@unocss/preset-icons@0.65.2': dependencies: - '@iconify/utils': 2.1.33 - '@unocss/core': 0.65.1 + '@iconify/utils': 2.2.1 + '@unocss/core': 0.65.2 ofetch: 1.4.1 transitivePeerDependencies: - supports-color - '@unocss/preset-mini@0.65.1': + '@unocss/preset-mini@0.65.2': dependencies: - '@unocss/core': 0.65.1 - '@unocss/extractor-arbitrary-variants': 0.65.1 - '@unocss/rule-utils': 0.65.1 + '@unocss/core': 0.65.2 + '@unocss/extractor-arbitrary-variants': 0.65.2 + '@unocss/rule-utils': 0.65.2 - '@unocss/preset-tagify@0.65.1': + '@unocss/preset-tagify@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 - '@unocss/preset-typography@0.65.1': + '@unocss/preset-typography@0.65.2': dependencies: - '@unocss/core': 0.65.1 - '@unocss/preset-mini': 0.65.1 + '@unocss/core': 0.65.2 + '@unocss/preset-mini': 0.65.2 - '@unocss/preset-uno@0.65.1': + '@unocss/preset-uno@0.65.2': dependencies: - '@unocss/core': 0.65.1 - '@unocss/preset-mini': 0.65.1 - '@unocss/preset-wind': 0.65.1 - '@unocss/rule-utils': 0.65.1 + '@unocss/core': 0.65.2 + '@unocss/preset-mini': 0.65.2 + '@unocss/preset-wind': 0.65.2 + '@unocss/rule-utils': 0.65.2 - '@unocss/preset-web-fonts@0.65.1': + '@unocss/preset-web-fonts@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 ofetch: 1.4.1 - '@unocss/preset-wind@0.65.1': + '@unocss/preset-wind@0.65.2': dependencies: - '@unocss/core': 0.65.1 - '@unocss/preset-mini': 0.65.1 - '@unocss/rule-utils': 0.65.1 + '@unocss/core': 0.65.2 + '@unocss/preset-mini': 0.65.2 + '@unocss/rule-utils': 0.65.2 - '@unocss/reset@0.65.1': {} + '@unocss/reset@0.65.2': {} - '@unocss/rule-utils@0.65.1': + '@unocss/rule-utils@0.65.2': dependencies: - '@unocss/core': 0.65.1 - magic-string: 0.30.14 + '@unocss/core': 0.65.2 + magic-string: 0.30.17 - '@unocss/transformer-attributify-jsx@0.65.1': + '@unocss/transformer-attributify-jsx@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 - '@unocss/transformer-compile-class@0.65.1': + '@unocss/transformer-compile-class@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 - '@unocss/transformer-directives@0.65.1': + '@unocss/transformer-directives@0.65.2': dependencies: - '@unocss/core': 0.65.1 - '@unocss/rule-utils': 0.65.1 - css-tree: 3.0.1 + '@unocss/core': 0.65.2 + '@unocss/rule-utils': 0.65.2 + css-tree: 3.1.0 - '@unocss/transformer-variant-group@0.65.1': + '@unocss/transformer-variant-group@0.65.2': dependencies: - '@unocss/core': 0.65.1 + '@unocss/core': 0.65.2 - '@unocss/vite@0.65.1(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2))': + '@unocss/vite@0.65.2(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2))': dependencies: '@ampproject/remapping': 2.3.0 - '@rollup/pluginutils': 5.1.3(rollup@4.28.1) - '@unocss/config': 0.65.1 - '@unocss/core': 0.65.1 - '@unocss/inspector': 0.65.1(vue@3.5.12(typescript@5.7.2)) + '@rollup/pluginutils': 5.1.4(rollup@4.28.1) + '@unocss/config': 0.65.2 + '@unocss/core': 0.65.2 + '@unocss/inspector': 0.65.2(vue@3.5.12(typescript@5.7.2)) chokidar: 3.6.0 - magic-string: 0.30.14 + magic-string: 0.30.17 tinyglobby: 0.2.10 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) transitivePeerDependencies: - rollup - supports-color @@ -12573,30 +12605,30 @@ snapshots: sharp-ico: 0.1.5 unconfig: 0.3.11 - '@vite-pwa/vitepress@0.5.3(@vite-pwa/assets-generator@0.2.6)(vite-plugin-pwa@0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0))': + '@vite-pwa/vitepress@0.5.3(@vite-pwa/assets-generator@0.2.6)(vite-plugin-pwa@0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0))': dependencies: - vite-plugin-pwa: 0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0) + vite-plugin-pwa: 0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0) optionalDependencies: '@vite-pwa/assets-generator': 0.2.6 - '@vitejs/plugin-basic-ssl@1.0.2(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))': + '@vitejs/plugin-basic-ssl@1.0.2(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))': dependencies: - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) - '@vitejs/plugin-react@4.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))': + '@vitejs/plugin-react@4.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))': dependencies: '@babel/core': 7.24.4 '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.24.4) '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.24.4) '@types/babel__core': 7.20.5 react-refresh: 0.14.0 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2))': + '@vitejs/plugin-vue@5.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2))': dependencies: - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vue: 3.5.12(typescript@5.7.2) '@vitest/eslint-plugin@1.1.14(@typescript-eslint/utils@8.17.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.7.2))(eslint@9.16.0(jiti@2.4.1))(typescript@5.7.2)(vitest@packages+vitest)': @@ -12669,7 +12701,7 @@ snapshots: '@vue/compiler-ssr': 3.5.12 '@vue/shared': 3.5.12 estree-walker: 2.0.2 - magic-string: 0.30.14 + magic-string: 0.30.17 postcss: 8.4.47 source-map-js: 1.2.1 @@ -12681,7 +12713,7 @@ snapshots: '@vue/compiler-ssr': 3.5.13 '@vue/shared': 3.5.13 estree-walker: 2.0.2 - magic-string: 0.30.14 + magic-string: 0.30.17 postcss: 8.4.49 source-map-js: 1.2.1 @@ -12915,11 +12947,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@wdio/config@8.40.6': + '@wdio/config@8.41.0': dependencies: '@wdio/logger': 8.38.0 - '@wdio/types': 8.40.6 - '@wdio/utils': 8.40.6 + '@wdio/types': 8.41.0 + '@wdio/utils': 8.41.0 decamelize: 6.0.0 deepmerge-ts: 5.1.0 glob: 10.4.1 @@ -12927,12 +12959,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@wdio/config@9.2.8': + '@wdio/config@9.4.4': dependencies: - '@wdio/logger': 9.1.3 - '@wdio/types': 9.2.2 - '@wdio/utils': 9.2.8 - decamelize: 6.0.0 + '@wdio/logger': 9.4.4 + '@wdio/types': 9.4.4 + '@wdio/utils': 9.4.4 deepmerge-ts: 7.1.0 glob: 10.4.1 import-meta-resolve: 4.0.0 @@ -12953,7 +12984,7 @@ snapshots: loglevel-plugin-prefix: 0.8.4 strip-ansi: 7.1.0 - '@wdio/logger@9.1.3': + '@wdio/logger@9.4.4': dependencies: chalk: 5.3.0 loglevel: 1.8.1 @@ -12964,7 +12995,7 @@ snapshots: '@wdio/protocols@8.40.3': {} - '@wdio/protocols@9.2.2': {} + '@wdio/protocols@9.4.4': {} '@wdio/repl@8.24.12': dependencies: @@ -12972,9 +13003,9 @@ snapshots: '@wdio/repl@8.40.3': dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 - '@wdio/repl@9.0.8': + '@wdio/repl@9.4.4': dependencies: '@types/node': 20.14.15 @@ -12982,11 +13013,11 @@ snapshots: dependencies: '@types/node': 20.14.15 - '@wdio/types@8.40.6': + '@wdio/types@8.41.0': dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 - '@wdio/types@9.2.2': + '@wdio/types@9.4.4': dependencies: '@types/node': 20.14.15 @@ -13008,15 +13039,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@wdio/utils@8.40.6': + '@wdio/utils@8.41.0': dependencies: '@puppeteer/browsers': 1.9.1 '@wdio/logger': 8.38.0 - '@wdio/types': 8.40.6 + '@wdio/types': 8.41.0 decamelize: 6.0.0 deepmerge-ts: 5.1.0 edgedriver: 5.6.1 - geckodriver: 4.4.3 + geckodriver: 4.2.1 get-port: 7.0.0 import-meta-resolve: 4.0.0 locate-app: 2.4.27 @@ -13026,19 +13057,19 @@ snapshots: transitivePeerDependencies: - supports-color - '@wdio/utils@9.2.8': + '@wdio/utils@9.4.4': dependencies: '@puppeteer/browsers': 2.3.1 - '@wdio/logger': 9.1.3 - '@wdio/types': 9.2.2 + '@wdio/logger': 9.4.4 + '@wdio/types': 9.4.4 decamelize: 6.0.0 deepmerge-ts: 7.1.0 - edgedriver: 5.6.1 - geckodriver: 4.4.3 + edgedriver: 6.1.1 + geckodriver: 5.0.0 get-port: 7.0.0 import-meta-resolve: 4.0.0 locate-app: 2.4.27 - safaridriver: 0.1.2 + safaridriver: 1.0.0 split2: 4.2.0 wait-port: 1.1.0 transitivePeerDependencies: @@ -13050,6 +13081,8 @@ snapshots: '@zip.js/zip.js@2.7.48': {} + '@zip.js/zip.js@2.7.54': {} + abbrev@2.0.0: {} abort-controller@3.0.0: @@ -13192,7 +13225,7 @@ snapshots: archiver@7.0.1: dependencies: archiver-utils: 5.0.2 - async: 3.2.4 + async: 3.2.6 buffer-crc32: 1.0.0 readable-stream: 4.1.0 readdir-glob: 1.1.2 @@ -13435,7 +13468,7 @@ snapshots: builtin-modules@3.3.0: {} - bumpp@9.9.0(magicast@0.3.5): + bumpp@9.9.1(magicast@0.3.5): dependencies: c12: 2.0.1(magicast@0.3.5) cac: 6.7.14(patch_hash=slh3cigivjjjktoa42g2agwaem) @@ -13453,9 +13486,9 @@ snapshots: dependencies: run-applescript: 5.0.0 - bundle-require@5.0.0(esbuild@0.23.0): + bundle-require@5.0.0(esbuild@0.24.0): dependencies: - esbuild: 0.23.0 + esbuild: 0.24.0 load-tsconfig: 0.2.5 busboy@1.6.0: @@ -13895,9 +13928,9 @@ snapshots: css-shorthand-properties@1.1.1: {} - css-tree@3.0.1: + css-tree@3.1.0: dependencies: - mdn-data: 2.12.1 + mdn-data: 2.12.2 source-map-js: 1.2.1 css-value@0.0.1: {} @@ -14227,6 +14260,20 @@ snapshots: node-fetch: 3.3.2 which: 4.0.0 + edgedriver@6.1.1: + dependencies: + '@wdio/logger': 9.4.4 + '@zip.js/zip.js': 2.7.54 + decamelize: 6.0.0 + edge-paths: 3.0.5 + fast-xml-parser: 4.5.1 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.5 + node-fetch: 3.3.2 + which: 5.0.0 + transitivePeerDependencies: + - supports-color + editorconfig@1.0.4: dependencies: '@one-ini/wasm': 0.1.1 @@ -14972,6 +15019,10 @@ snapshots: dependencies: strnum: 1.0.5 + fast-xml-parser@4.5.1: + dependencies: + strnum: 1.0.5 + fastify@4.26.2: dependencies: '@fastify/ajv-compiler': 3.5.0 @@ -15005,10 +15056,6 @@ snapshots: optionalDependencies: picomatch: 4.0.2 - fdir@6.4.0(picomatch@4.0.2): - optionalDependencies: - picomatch: 4.0.2 - fdir@6.4.2(picomatch@4.0.2): optionalDependencies: picomatch: 4.0.2 @@ -15200,6 +15247,19 @@ snapshots: - encoding - supports-color + geckodriver@4.2.1: + dependencies: + '@wdio/logger': 8.38.0 + decamelize: 6.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.5 + node-fetch: 3.3.2 + tar-fs: 3.0.6 + unzipper: 0.10.14 + which: 4.0.0 + transitivePeerDependencies: + - supports-color + geckodriver@4.3.2: dependencies: '@wdio/logger': 8.38.0 @@ -15213,16 +15273,16 @@ snapshots: transitivePeerDependencies: - supports-color - geckodriver@4.4.3: + geckodriver@5.0.0: dependencies: - '@wdio/logger': 9.1.3 - '@zip.js/zip.js': 2.7.48 + '@wdio/logger': 9.4.4 + '@zip.js/zip.js': 2.7.54 decamelize: 6.0.0 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.5 node-fetch: 3.3.2 tar-fs: 3.0.6 - which: 4.0.0 + which: 5.0.0 transitivePeerDependencies: - supports-color @@ -15491,6 +15551,20 @@ snapshots: stringify-entities: 4.0.4 zwitch: 2.0.4 + hast-util-to-html@9.0.4: + dependencies: + '@types/hast': 3.0.4 + '@types/unist': 3.0.2 + ccount: 2.0.1 + comma-separated-tokens: 2.0.3 + hast-util-whitespace: 3.0.0 + html-void-elements: 3.0.0 + mdast-util-to-hast: 13.2.0 + property-information: 6.5.0 + space-separated-tokens: 2.0.2 + stringify-entities: 4.0.4 + zwitch: 2.0.4 + hast-util-whitespace@3.0.0: dependencies: '@types/hast': 3.0.4 @@ -15631,15 +15705,13 @@ snapshots: import-meta-resolve@4.0.0: {} - importx@0.4.3: + importx@0.5.1: dependencies: - bundle-require: 5.0.0(esbuild@0.23.0) + bundle-require: 5.0.0(esbuild@0.24.0) debug: 4.4.0 - esbuild: 0.23.0 - jiti: 2.0.0-beta.2 - jiti-v1: jiti@1.21.6 + esbuild: 0.24.0 + jiti: 2.4.1 pathe: 1.1.2 - pkg-types: 1.2.1 tsx: 4.19.2 transitivePeerDependencies: - supports-color @@ -15953,7 +16025,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.10.1 + '@types/node': 22.10.2 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -15962,8 +16034,6 @@ snapshots: jiti@1.21.6: {} - jiti@2.0.0-beta.2: {} - jiti@2.4.1: {} js-beautify@1.15.1: @@ -16266,7 +16336,7 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 - magic-string@0.30.14: + magic-string@0.30.17: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -16403,7 +16473,7 @@ snapshots: dependencies: '@types/mdast': 4.0.3 - mdn-data@2.12.1: {} + mdn-data@2.12.2: {} media-typer@0.3.0: {} @@ -16627,7 +16697,7 @@ snapshots: mime@3.0.0: {} - mime@4.0.4: {} + mime@4.0.6: {} mimic-fn@2.1.0: {} @@ -16721,23 +16791,23 @@ snapshots: ms@2.1.3: {} - msw@2.6.8(@types/node@22.10.1)(typescript@5.7.2): + msw@2.7.0(@types/node@22.10.2)(typescript@5.7.2): dependencies: '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.0.1(@types/node@22.10.1) + '@inquirer/confirm': 5.0.1(@types/node@22.10.2) '@mswjs/interceptors': 0.37.3 '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 '@types/statuses': 2.0.5 - chalk: 4.1.2 graphql: 16.9.0 headers-polyfill: 4.0.3 is-node-process: 1.2.0 outvariant: 1.4.3 path-to-regexp: 6.3.0 + picocolors: 1.1.1 strict-event-emitter: 0.5.1 type-fest: 4.26.1 yargs: 17.7.2 @@ -16895,11 +16965,11 @@ snapshots: dependencies: mimic-fn: 4.0.0 - oniguruma-to-es@0.7.0: + oniguruma-to-es@0.8.0: dependencies: emoji-regex-xs: 1.0.0 regex: 5.0.2 - regex-recursion: 4.3.0 + regex-recursion: 5.0.0 oniguruma-to-js@0.4.3: dependencies: @@ -17114,12 +17184,20 @@ snapshots: playwright-core@1.49.0: {} + playwright-core@1.49.1: {} + playwright@1.49.0: dependencies: playwright-core: 1.49.0 optionalDependencies: fsevents: 2.3.2 + playwright@1.49.1: + dependencies: + playwright-core: 1.49.1 + optionalDependencies: + fsevents: 2.3.2 + pluralize@8.0.0: {} possible-typed-array-names@1.0.0: {} @@ -17435,7 +17513,7 @@ snapshots: dependencies: '@babel/runtime': 7.26.0 - regex-recursion@4.3.0: + regex-recursion@5.0.0: dependencies: regex-utilities: 2.3.0 @@ -17551,7 +17629,7 @@ snapshots: rollup-plugin-dts@6.1.1(rollup@4.28.1)(typescript@5.7.2): dependencies: - magic-string: 0.30.14 + magic-string: 0.30.17 rollup: 4.28.1 typescript: 5.7.2 optionalDependencies: @@ -17573,7 +17651,7 @@ snapshots: commenting: 1.1.0 fdir: 6.3.0(picomatch@4.0.2) lodash: 4.17.21 - magic-string: 0.30.14 + magic-string: 0.30.17 moment: 2.30.1 package-name-regex: 2.0.6 rollup: 4.28.1 @@ -17809,13 +17887,13 @@ snapshots: '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 - shiki@1.24.2: + shiki@1.24.3: dependencies: - '@shikijs/core': 1.24.2 - '@shikijs/engine-javascript': 1.24.2 - '@shikijs/engine-oniguruma': 1.24.2 - '@shikijs/types': 1.24.2 - '@shikijs/vscode-textmate': 9.3.0 + '@shikijs/core': 1.24.3 + '@shikijs/engine-javascript': 1.24.3 + '@shikijs/engine-oniguruma': 1.24.3 + '@shikijs/types': 1.24.3 + '@shikijs/vscode-textmate': 9.3.1 '@types/hast': 3.0.4 side-channel@1.0.4: @@ -17855,12 +17933,6 @@ snapshots: mrmime: 1.0.1 totalist: 3.0.0 - sirv@2.0.4: - dependencies: - '@polka/url': 1.0.0-next.24 - mrmime: 2.0.0 - totalist: 3.0.0 - sirv@3.0.0: dependencies: '@polka/url': 1.0.0-next.24 @@ -18012,11 +18084,6 @@ snapshots: streamsearch@1.1.0: {} - streamx@2.15.1: - dependencies: - fast-fifo: 1.3.2 - queue-tick: 1.0.1 - streamx@2.20.1: dependencies: fast-fifo: 1.3.2 @@ -18024,7 +18091,6 @@ snapshots: text-decoder: 1.1.1 optionalDependencies: bare-events: 2.4.2 - optional: true strict-event-emitter@0.5.1: {} @@ -18258,7 +18324,7 @@ snapshots: dependencies: b4a: 1.6.4 fast-fifo: 1.3.2 - streamx: 2.15.1 + streamx: 2.20.1 tar@6.2.0: dependencies: @@ -18294,7 +18360,6 @@ snapshots: text-decoder@1.1.1: dependencies: b4a: 1.6.4 - optional: true thread-stream@2.1.0: dependencies: @@ -18531,18 +18596,16 @@ snapshots: jiti: 1.21.6 mlly: 1.7.3 - unconfig@0.5.5: + unconfig@0.6.0: dependencies: '@antfu/utils': 0.7.10 defu: 6.1.4 - importx: 0.4.3 + importx: 0.5.1 transitivePeerDependencies: - supports-color undici-types@5.26.5: {} - undici-types@6.19.8: {} - undici-types@6.20.0: {} undici@5.22.1: @@ -18566,21 +18629,21 @@ snapshots: unicorn-magic@0.3.0: {} - unimport@3.14.3(rollup@4.28.1): + unimport@3.14.5(rollup@4.28.1): dependencies: '@rollup/pluginutils': 5.1.3(rollup@4.28.1) acorn: 8.11.3(patch_hash=no36qihqjrd3chyjw73dk5xfkm) escape-string-regexp: 5.0.0 estree-walker: 3.0.3 + fast-glob: 3.3.2 local-pkg: 0.5.1 - magic-string: 0.30.14 + magic-string: 0.30.17 mlly: 1.7.3 pathe: 1.1.2 picomatch: 4.0.2 pkg-types: 1.2.1 scule: 1.3.0 strip-literal: 2.1.1 - tinyglobby: 0.2.10 unplugin: 1.16.0 transitivePeerDependencies: - rollup @@ -18618,27 +18681,27 @@ snapshots: universalify@2.0.1: {} - unocss@0.65.1(postcss@8.4.49)(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)): - dependencies: - '@unocss/astro': 0.65.1(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) - '@unocss/cli': 0.65.1(rollup@4.28.1) - '@unocss/core': 0.65.1 - '@unocss/postcss': 0.65.1(postcss@8.4.49) - '@unocss/preset-attributify': 0.65.1 - '@unocss/preset-icons': 0.65.1 - '@unocss/preset-mini': 0.65.1 - '@unocss/preset-tagify': 0.65.1 - '@unocss/preset-typography': 0.65.1 - '@unocss/preset-uno': 0.65.1 - '@unocss/preset-web-fonts': 0.65.1 - '@unocss/preset-wind': 0.65.1 - '@unocss/transformer-attributify-jsx': 0.65.1 - '@unocss/transformer-compile-class': 0.65.1 - '@unocss/transformer-directives': 0.65.1 - '@unocss/transformer-variant-group': 0.65.1 - '@unocss/vite': 0.65.1(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + unocss@0.65.2(postcss@8.4.49)(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)): + dependencies: + '@unocss/astro': 0.65.2(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + '@unocss/cli': 0.65.2(rollup@4.28.1) + '@unocss/core': 0.65.2 + '@unocss/postcss': 0.65.2(postcss@8.4.49) + '@unocss/preset-attributify': 0.65.2 + '@unocss/preset-icons': 0.65.2 + '@unocss/preset-mini': 0.65.2 + '@unocss/preset-tagify': 0.65.2 + '@unocss/preset-typography': 0.65.2 + '@unocss/preset-uno': 0.65.2 + '@unocss/preset-web-fonts': 0.65.2 + '@unocss/preset-wind': 0.65.2 + '@unocss/transformer-attributify-jsx': 0.65.2 + '@unocss/transformer-compile-class': 0.65.2 + '@unocss/transformer-directives': 0.65.2 + '@unocss/transformer-variant-group': 0.65.2 + '@unocss/vite': 0.65.2(rollup@4.28.1)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) optionalDependencies: - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) transitivePeerDependencies: - postcss - rollup @@ -18647,16 +18710,15 @@ snapshots: unpipe@1.0.0: {} - unplugin-auto-import@0.18.6(@vueuse/core@12.0.0(typescript@5.7.2))(rollup@4.28.1): + unplugin-auto-import@0.19.0(@vueuse/core@12.0.0(typescript@5.7.2))(rollup@4.28.1): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.1.3(rollup@4.28.1) - fast-glob: 3.3.2 local-pkg: 0.5.1 - magic-string: 0.30.14 - minimatch: 9.0.5 - unimport: 3.14.3(rollup@4.28.1) - unplugin: 1.16.0 + magic-string: 0.30.17 + picomatch: 4.0.2 + unimport: 3.14.5(rollup@4.28.1) + unplugin: 2.1.0 optionalDependencies: '@vueuse/core': 12.0.0(typescript@5.7.2) transitivePeerDependencies: @@ -18671,18 +18733,18 @@ snapshots: transitivePeerDependencies: - rollup - unplugin-vue-components@0.27.5(@babel/parser@7.26.2)(rollup@4.28.1)(vue@3.5.12(typescript@5.7.2)): + unplugin-vue-components@0.28.0(@babel/parser@7.26.2)(rollup@4.28.1)(vue@3.5.12(typescript@5.7.2)): dependencies: '@antfu/utils': 0.7.10 - '@rollup/pluginutils': 5.1.3(rollup@4.28.1) + '@rollup/pluginutils': 5.1.4(rollup@4.28.1) chokidar: 3.6.0 - debug: 4.3.7 + debug: 4.4.0 fast-glob: 3.3.2 local-pkg: 0.5.1 - magic-string: 0.30.14 + magic-string: 0.30.17 minimatch: 9.0.5 mlly: 1.7.3 - unplugin: 1.16.0 + unplugin: 2.1.0 vue: 3.5.12(typescript@5.7.2) optionalDependencies: '@babel/parser': 7.26.2 @@ -18702,6 +18764,11 @@ snapshots: webpack-sources: 3.2.3 webpack-virtual-modules: 0.6.1 + unplugin@2.1.0: + dependencies: + acorn: 8.11.3(patch_hash=no36qihqjrd3chyjw73dk5xfkm) + webpack-virtual-modules: 0.6.2 + untildify@4.0.0: {} unzipper@0.10.14: @@ -18798,7 +18865,7 @@ snapshots: unist-util-stringify-position: 4.0.0 vfile-message: 4.0.2 - vite-plugin-pages@0.32.4(@vue/compiler-sfc@3.5.13)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue-router@4.5.0(vue@3.5.12(typescript@5.7.2))): + vite-plugin-pages@0.32.4(@vue/compiler-sfc@3.5.13)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue-router@4.5.0(vue@3.5.12(typescript@5.7.2))): dependencies: '@types/debug': 4.1.12 debug: 4.4.0 @@ -18808,7 +18875,7 @@ snapshots: json5: 2.2.3 local-pkg: 0.5.1 picocolors: 1.1.1 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) yaml: 2.6.1 optionalDependencies: '@vue/compiler-sfc': 3.5.13 @@ -18816,12 +18883,12 @@ snapshots: transitivePeerDependencies: - supports-color - vite-plugin-pwa@0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0): + vite-plugin-pwa@0.21.1(@vite-pwa/assets-generator@0.2.6)(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.3.0): dependencies: debug: 4.3.7 pretty-bytes: 6.1.1 tinyglobby: 0.2.10 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) workbox-build: 7.1.0(@types/babel__core@7.20.5) workbox-window: 7.3.0 optionalDependencies: @@ -18839,43 +18906,43 @@ snapshots: fsevents: 2.3.3 terser: 5.36.0 - vite@5.4.0(@types/node@22.10.1)(terser@5.36.0): + vite@5.4.0(@types/node@22.10.2)(terser@5.36.0): dependencies: esbuild: 0.21.5 postcss: 8.4.40 rollup: 4.28.1 optionalDependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 fsevents: 2.3.3 terser: 5.36.0 - vitefu@0.2.5(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0)): + vitefu@0.2.5(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0)): optionalDependencies: - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vitepress-plugin-group-icons@1.3.1: dependencies: - '@iconify-json/logos': 1.2.3 + '@iconify-json/logos': 1.2.4 '@iconify-json/vscode-icons': 1.2.2 '@iconify/utils': 2.1.33 transitivePeerDependencies: - supports-color - vitepress-plugin-tabs@0.5.0(vitepress@1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.1)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2))(vue@3.5.12(typescript@5.7.2)): + vitepress-plugin-tabs@0.5.0(vitepress@1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.2)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2))(vue@3.5.12(typescript@5.7.2)): dependencies: - vitepress: 1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.1)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2) + vitepress: 1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.2)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2) vue: 3.5.12(typescript@5.7.2) - vitepress@1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.1)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2): + vitepress@1.5.0(@algolia/client-search@4.20.0)(@types/node@22.10.2)(@types/react@18.2.79)(postcss@8.4.49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.36.0)(typescript@5.7.2): dependencies: '@docsearch/css': 3.6.2 '@docsearch/js': 3.6.2(@algolia/client-search@4.20.0)(@types/react@18.2.79)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0) '@iconify-json/simple-icons': 1.2.11 '@shikijs/core': 1.22.2 - '@shikijs/transformers': 1.24.2 + '@shikijs/transformers': 1.24.3 '@shikijs/types': 1.22.2 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.2.1(vite@5.4.0(@types/node@22.10.1)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) + '@vitejs/plugin-vue': 5.2.1(vite@5.4.0(@types/node@22.10.2)(terser@5.36.0))(vue@3.5.12(typescript@5.7.2)) '@vue/devtools-api': 7.6.2 '@vue/shared': 3.5.12 '@vueuse/core': 11.2.0(vue@3.5.12(typescript@5.7.2)) @@ -18884,7 +18951,7 @@ snapshots: mark.js: 8.11.1 minisearch: 7.1.0 shiki: 1.22.2 - vite: 5.4.0(@types/node@22.10.1)(terser@5.36.0) + vite: 5.4.0(@types/node@22.10.2)(terser@5.36.0) vue: 3.5.12(typescript@5.7.2) optionalDependencies: postcss: 8.4.49 @@ -19063,15 +19130,15 @@ snapshots: - supports-color - utf-8-validate - webdriver@8.40.6: + webdriver@8.41.0: dependencies: - '@types/node': 22.10.1 + '@types/node': 22.10.2 '@types/ws': 8.5.13 - '@wdio/config': 8.40.6 + '@wdio/config': 8.41.0 '@wdio/logger': 8.38.0 '@wdio/protocols': 8.40.3 - '@wdio/types': 8.40.6 - '@wdio/utils': 8.40.6 + '@wdio/types': 8.41.0 + '@wdio/utils': 8.41.0 deepmerge-ts: 5.1.0 got: 12.6.1 ky: 0.33.3 @@ -19081,15 +19148,15 @@ snapshots: - supports-color - utf-8-validate - webdriver@9.4.1: + webdriver@9.4.4: dependencies: '@types/node': 20.14.15 '@types/ws': 8.5.13 - '@wdio/config': 9.2.8 - '@wdio/logger': 9.1.3 - '@wdio/protocols': 9.2.2 - '@wdio/types': 9.2.2 - '@wdio/utils': 9.2.8 + '@wdio/config': 9.4.4 + '@wdio/logger': 9.4.4 + '@wdio/protocols': 9.4.4 + '@wdio/types': 9.4.4 + '@wdio/utils': 9.4.4 deepmerge-ts: 7.1.0 undici: 6.21.0 ws: 8.18.0 @@ -19131,15 +19198,15 @@ snapshots: - typescript - utf-8-validate - webdriverio@8.40.6: + webdriverio@8.41.0: dependencies: - '@types/node': 22.7.5 - '@wdio/config': 8.40.6 + '@types/node': 22.10.2 + '@wdio/config': 8.41.0 '@wdio/logger': 8.38.0 '@wdio/protocols': 8.40.3 '@wdio/repl': 8.40.3 - '@wdio/types': 8.40.6 - '@wdio/utils': 8.40.6 + '@wdio/types': 8.41.0 + '@wdio/utils': 8.41.0 archiver: 7.0.1 aria-query: 5.3.0 css-shorthand-properties: 1.1.1 @@ -19157,23 +19224,23 @@ snapshots: resq: 1.11.0 rgb2hex: 0.2.5 serialize-error: 11.0.3 - webdriver: 8.40.6 + webdriver: 8.41.0 transitivePeerDependencies: - bufferutil - encoding - supports-color - utf-8-validate - webdriverio@9.4.1: + webdriverio@9.4.5: dependencies: '@types/node': 20.14.15 '@types/sinonjs__fake-timers': 8.1.5(patch_hash=yuuqouzdhxwdvk3q6qf2uf434a) - '@wdio/config': 9.2.8 - '@wdio/logger': 9.1.3 - '@wdio/protocols': 9.2.2 - '@wdio/repl': 9.0.8 - '@wdio/types': 9.2.2 - '@wdio/utils': 9.2.8 + '@wdio/config': 9.4.4 + '@wdio/logger': 9.4.4 + '@wdio/protocols': 9.4.4 + '@wdio/repl': 9.4.4 + '@wdio/types': 9.4.4 + '@wdio/utils': 9.4.4 archiver: 7.0.1 aria-query: 5.3.0 cheerio: 1.0.0 @@ -19192,7 +19259,7 @@ snapshots: rgb2hex: 0.2.5 serialize-error: 11.0.3 urlpattern-polyfill: 10.0.0 - webdriver: 9.4.1 + webdriver: 9.4.4 transitivePeerDependencies: - bufferutil - supports-color @@ -19273,6 +19340,10 @@ snapshots: dependencies: isexe: 3.1.1 + which@5.0.0: + dependencies: + isexe: 3.1.1 + why-is-node-running@2.3.0: dependencies: siginfo: 2.0.0 @@ -19294,7 +19365,7 @@ snapshots: '@babel/preset-env': 7.26.0(@babel/core@7.26.0) '@babel/runtime': 7.26.0 '@rollup/plugin-babel': 5.3.1(@babel/core@7.26.0)(@types/babel__core@7.20.5)(rollup@4.28.1) - '@rollup/plugin-node-resolve': 15.3.0(rollup@4.28.1) + '@rollup/plugin-node-resolve': 15.3.1(rollup@4.28.1) '@rollup/plugin-replace': 2.4.2(rollup@4.28.1) '@rollup/plugin-terser': 0.4.4(rollup@4.28.1) '@surma/rollup-plugin-off-main-thread': 2.2.3 @@ -19508,4 +19579,4 @@ snapshots: zx@8.2.4: optionalDependencies: '@types/fs-extra': 11.0.4 - '@types/node': 22.10.1 + '@types/node': 22.10.2 diff --git a/test/benchmark/fixtures/basic/should-not-run.test-d.ts b/test/benchmark/fixtures/basic/should-not-run.test-d.ts new file mode 100644 index 000000000000..eb35b7540de5 --- /dev/null +++ b/test/benchmark/fixtures/basic/should-not-run.test-d.ts @@ -0,0 +1,7 @@ +import { describe, expectTypeOf, test } from 'vitest' + +describe('test', () => { + test('some-test', () => { + expectTypeOf({ a: 1 }).toEqualTypeOf({ a: "should not match" }) + }) +}) diff --git a/test/benchmark/test/basic.test.ts b/test/benchmark/test/basic.test.ts index b20ff4d3e75d..b0cb1e0f72ec 100644 --- a/test/benchmark/test/basic.test.ts +++ b/test/benchmark/test/basic.test.ts @@ -13,6 +13,9 @@ it('basic', { timeout: 60_000 }, async () => { root, allowOnly: true, outputJson: 'bench.json', + + // Verify that type testing cannot be used with benchmark + typecheck: { enabled: true }, }, [], 'benchmark') expect(result.exitCode).toBe(0) diff --git a/test/browser/fixtures/benchmark/vitest.config.ts b/test/browser/fixtures/benchmark/vitest.config.ts index 2214155ca2c6..c57a43ee6168 100644 --- a/test/browser/fixtures/benchmark/vitest.config.ts +++ b/test/browser/fixtures/benchmark/vitest.config.ts @@ -1,16 +1,14 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ test: { browser: { enabled: true, + headless: true, provider, - name, + instances, }, }, cacheDir: fileURLToPath(new URL("./node_modules/.vite", import.meta.url)), diff --git a/test/browser/fixtures/locators/vitest.config.ts b/test/browser/fixtures/locators/vitest.config.ts index e32545f4ab22..d8b79ec319ef 100644 --- a/test/browser/fixtures/locators/vitest.config.ts +++ b/test/browser/fixtures/locators/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ optimizeDeps: { @@ -15,8 +12,8 @@ export default defineConfig({ browser: { enabled: true, provider, - name, headless: true, + instances, }, onConsoleLog(log) { if (log.includes('ReactDOMTestUtils.act')) { diff --git a/test/browser/fixtures/mocking-watch/vitest.config.ts b/test/browser/fixtures/mocking-watch/vitest.config.ts index ebe6e47aaef6..74daa1beee99 100644 --- a/test/browser/fixtures/mocking-watch/vitest.config.ts +++ b/test/browser/fixtures/mocking-watch/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ optimizeDeps: { @@ -15,7 +12,7 @@ export default defineConfig({ fileParallelism: false, enabled: true, provider, - name, + instances, headless: true, }, }, diff --git a/test/browser/fixtures/mocking/vitest.config.ts b/test/browser/fixtures/mocking/vitest.config.ts index 3620bdc48ef4..f72ca8935f64 100644 --- a/test/browser/fixtures/mocking/vitest.config.ts +++ b/test/browser/fixtures/mocking/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ optimizeDeps: { @@ -15,7 +12,7 @@ export default defineConfig({ browser: { enabled: true, provider, - name, + instances, headless: true, }, }, diff --git a/test/browser/fixtures/multiple-different-configs/basic.test.js b/test/browser/fixtures/multiple-different-configs/basic.test.js new file mode 100644 index 000000000000..f5480f9199a5 --- /dev/null +++ b/test/browser/fixtures/multiple-different-configs/basic.test.js @@ -0,0 +1,23 @@ +import { test as baseTest, expect, inject } from 'vitest'; +import { server } from '@vitest/browser/context' + +const test = baseTest.extend({ + // chromium should inject the value as "true" + // firefox doesn't provide this value in the config, it will stay undefined + providedVar: [undefined, { injected: true }] +}) + +test('html injected', ({ providedVar }) => { + // window.HTML_INJECTED_VAR is injected only for chromium via a script in customTester.html + console.log(`[${server.config.name}] HTML_INJECTED_VAR is ${window.HTML_INJECTED_VAR}`) + expect(providedVar).toBe(window.HTML_INJECTED_VAR) +}) + +test.runIf(server.config.name === 'firefox')('[firefox] firefoxValue injected', ({ providedVar }) => { + expect(providedVar).toBeUndefined() + expect(inject('firefoxValue')).toBe(true) +}) + +test.runIf(server.config.name === 'chromium')('[chromium] firefoxValue is not injected', () => { + expect(inject('firefoxValue')).toBeUndefined() +}) \ No newline at end of file diff --git a/test/browser/fixtures/multiple-different-configs/customTester.html b/test/browser/fixtures/multiple-different-configs/customTester.html new file mode 100644 index 000000000000..97cc881fe0a2 --- /dev/null +++ b/test/browser/fixtures/multiple-different-configs/customTester.html @@ -0,0 +1,13 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/test/browser/fixtures/multiple-different-configs/vitest.config.js b/test/browser/fixtures/multiple-different-configs/vitest.config.js new file mode 100644 index 000000000000..8c0598179894 --- /dev/null +++ b/test/browser/fixtures/multiple-different-configs/vitest.config.js @@ -0,0 +1,33 @@ +import { defineConfig } from 'vitest/config'; +import { fileURLToPath } from 'node:url' + +const provider = process.env.PROVIDER || 'playwright' + +export default defineConfig({ + clearScreen: false, + cacheDir: fileURLToPath(new URL("./node_modules/.vite", import.meta.url)), + test: { + browser: { + provider: provider, + enabled: true, + headless: true, + screenshotFailures: false, + instances: [ + { + browser: provider === 'playwright' ? 'chromium' : 'chrome', + testerHtmlPath: './customTester.html', + provide: { + providedVar: true, + }, + name: 'chromium', + }, + { + browser: 'firefox', + provide: { + firefoxValue: true, + }, + }, + ], + }, + }, +}) diff --git a/test/browser/fixtures/server-url/vitest.config.ts b/test/browser/fixtures/server-url/vitest.config.ts index 25eb22e5965b..ad483f64e89d 100644 --- a/test/browser/fixtures/server-url/vitest.config.ts +++ b/test/browser/fixtures/server-url/vitest.config.ts @@ -2,13 +2,11 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' import basicSsl from '@vitejs/plugin-basic-ssl' +import { instances, provider } from '../../settings' // test https by // TEST_HTTPS=1 pnpm test-fixtures --root fixtures/server-url -const provider = process.env.PROVIDER || 'playwright'; -const browser = process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome'); - // ignore https errors due to self-signed certificate from plugin-basic-ssl // https://playwright.dev/docs/api/class-browser#browser-new-context-option-ignore-https-errors // https://webdriver.io/docs/configuration/#strictssl and acceptInsecureCerts in https://webdriver.io/docs/api/browser/#properties @@ -28,8 +26,10 @@ export default defineConfig({ api: process.env.TEST_HTTPS ? 51122 : 51133, enabled: true, provider, - name: browser, - providerOptions, + instances: instances.map(instance => ({ + ...instance, + ...providerOptions, + })), }, }, // separate cacheDir from test/browser/vite.config.ts diff --git a/test/browser/fixtures/setup-file/vitest.config.ts b/test/browser/fixtures/setup-file/vitest.config.ts index 8172e44773a7..e14b3cbf47f9 100644 --- a/test/browser/fixtures/setup-file/vitest.config.ts +++ b/test/browser/fixtures/setup-file/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ cacheDir: fileURLToPath(new URL("./node_modules/.vite", import.meta.url)), @@ -12,7 +9,7 @@ export default defineConfig({ browser: { enabled: true, provider, - name, + instances, headless: false, }, }, diff --git a/test/browser/fixtures/timeout/vitest.config.ts b/test/browser/fixtures/timeout/vitest.config.ts index 997fa84abcc4..b482d8bb44e6 100644 --- a/test/browser/fixtures/timeout/vitest.config.ts +++ b/test/browser/fixtures/timeout/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ cacheDir: fileURLToPath(new URL("./node_modules/.vite", import.meta.url)), @@ -11,17 +8,17 @@ export default defineConfig({ browser: { enabled: true, provider, - name, - providerOptions: { + instances: instances.map(instance => ({ + ...instance, context: { - actionTimeout: 500 - } - } + actionTimeout: 500, + }, + })), }, expect: { poll: { - timeout: 500 - } - } + timeout: 500, + }, + }, }, }) diff --git a/test/browser/fixtures/unhandled/vitest.config.ts b/test/browser/fixtures/unhandled/vitest.config.ts index 5f5d430812b3..c98221e84305 100644 --- a/test/browser/fixtures/unhandled/vitest.config.ts +++ b/test/browser/fixtures/unhandled/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { instances, provider } from '../../settings' export default defineConfig({ cacheDir: fileURLToPath(new URL("./node_modules/.vite", import.meta.url)), @@ -11,7 +8,7 @@ export default defineConfig({ browser: { enabled: true, provider, - name, + instances, headless: true, }, }, diff --git a/test/browser/fixtures/update-snapshot/vitest.config.ts b/test/browser/fixtures/update-snapshot/vitest.config.ts index aec07d121a3f..23e4c31f07ff 100644 --- a/test/browser/fixtures/update-snapshot/vitest.config.ts +++ b/test/browser/fixtures/update-snapshot/vitest.config.ts @@ -1,22 +1,19 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' +import { instances, provider } from '../../settings' /* manually test snapshot by pnpm -C test/browser test-fixtures --root fixtures/update-snapshot */ -const provider = process.env.PROVIDER || 'playwright' -const browser = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') - export default defineConfig({ test: { browser: { enabled: true, provider, - name: browser, + instances, }, }, cacheDir: path.join( diff --git a/test/browser/fixtures/user-event/vitest.config.ts b/test/browser/fixtures/user-event/vitest.config.ts index c3fe79b6ac9c..52962b06a2cc 100644 --- a/test/browser/fixtures/user-event/vitest.config.ts +++ b/test/browser/fixtures/user-event/vitest.config.ts @@ -1,9 +1,6 @@ import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' - -const provider = process.env.PROVIDER || 'playwright' -const name = - process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome') +import { provider, instances } from '../../settings' export default defineConfig({ cacheDir: fileURLToPath(new URL("./node_modules/.vite", import.meta.url)), @@ -11,7 +8,7 @@ export default defineConfig({ browser: { enabled: true, provider, - name, + instances, }, }, }) diff --git a/test/browser/package.json b/test/browser/package.json index aa7c3602ba69..0d9c6742185d 100644 --- a/test/browser/package.json +++ b/test/browser/package.json @@ -12,6 +12,7 @@ "test-mocking": "vitest --root ./fixtures/mocking", "test-mocking-watch": "vitest --root ./fixtures/mocking-watch", "test-locators": "vitest --root ./fixtures/locators", + "test-different-configs": "vitest --root ./fixtures/multiple-different-configs", "test-setup-file": "vitest --root ./fixtures/setup-file", "test-snapshots": "vitest --root ./fixtures/update-snapshot", "coverage": "vitest --coverage.enabled --coverage.provider=istanbul --browser.headless=yes", diff --git a/test/browser/settings.ts b/test/browser/settings.ts new file mode 100644 index 000000000000..19022e7baaef --- /dev/null +++ b/test/browser/settings.ts @@ -0,0 +1,25 @@ +import type { BrowserInstanceOption } from 'vitest/node' + +export const provider = process.env.PROVIDER || 'playwright' +export const browser = process.env.BROWSER || (provider !== 'playwright' ? 'chromium' : 'chrome') + +const devInstances: BrowserInstanceOption[] = [ + { browser }, +] + +const playwrightInstances: BrowserInstanceOption[] = [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, +] + +const webdriverioInstances: BrowserInstanceOption[] = [ + { browser: 'chrome' }, + { browser: 'firefox' }, +] + +export const instances = process.env.BROWSER + ? devInstances + : provider === 'playwright' + ? playwrightInstances + : webdriverioInstances diff --git a/test/browser/setup.unit.ts b/test/browser/setup.unit.ts new file mode 100644 index 000000000000..dd69c73378c1 --- /dev/null +++ b/test/browser/setup.unit.ts @@ -0,0 +1,55 @@ +import { expect } from 'vitest' + +interface SummaryOptions { + passed?: number +} + +expect.extend({ + toReportPassedTest(stdout: string, testName: string, testProject?: string) { + const includePattern = `✓ ${testProject ? `|${testProject}| ` : ''}${testName}` + const pass = stdout.includes(`✓ ${testProject ? `|${testProject}| ` : ''}${testName}`) + return { + pass, + message: () => `expected ${pass ? 'not ' : ''}to have "${includePattern}" in the report.\n\nstdout:\n${stdout}`, + } + }, + toReportSummaryTestFiles(stdout: string, { passed }: SummaryOptions) { + const includePattern = `Test Files ${passed} passed` + const pass = !passed || stdout.includes(includePattern) + return { + pass, + message: () => `expected ${pass ? 'not ' : ''}to have "${includePattern}" in the report.\n\nstdout:\n${stdout}`, + } + }, + toReportSummaryTests(stdout: string, { passed }: SummaryOptions) { + const includePattern = `Tests ${passed} passed` + const pass = !passed || stdout.includes(includePattern) + return { + pass, + message: () => `expected ${pass ? 'not ' : ''}to have "${includePattern}" in the report.\n\nstdout:\n${stdout}`, + } + }, + toReportNoErrors(stderr: string) { + const pass = !stderr + return { + pass, + message: () => `expected ${pass ? 'not ' : ''}to have no errors.\n\nstderr:\n${stderr}`, + } + }, +}) + +declare module 'vitest' { + // eslint-disable-next-line unused-imports/no-unused-vars + interface Assertion { + // eslint-disable-next-line ts/method-signature-style + toReportPassedTest(testName: string, testProject?: string): void + // eslint-disable-next-line ts/method-signature-style + toReportSummaryTestFiles(options: SummaryOptions): void + // eslint-disable-next-line ts/method-signature-style + toReportSummaryTests(options: SummaryOptions): void + // eslint-disable-next-line ts/method-signature-style + toReportNoErrors(): void + } +} + +export {} diff --git a/test/browser/specs/benchmark.test.ts b/test/browser/specs/benchmark.test.ts index ac5cec0f7959..1b3eb94b5d7c 100644 --- a/test/browser/specs/benchmark.test.ts +++ b/test/browser/specs/benchmark.test.ts @@ -3,7 +3,8 @@ import { runVitest } from '../../test-utils' test('benchmark', async () => { const result = await runVitest({ root: 'fixtures/benchmark' }, [], 'benchmark') - expect(result.stderr).toBe('') + expect(result.stderr).toReportNoErrors() + // TODO 2024-12-11 check |name| when it's supported expect(result.stdout).toContain('✓ basic.bench.ts > suite-a') expect(result.exitCode).toBe(0) }) diff --git a/test/browser/specs/filter.test.ts b/test/browser/specs/filter.test.ts index c07099cfcaf7..864bfbc6fd83 100644 --- a/test/browser/specs/filter.test.ts +++ b/test/browser/specs/filter.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import { runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' test('filter', async () => { const { stderr, stdout } = await runBrowserTests({ @@ -8,7 +8,9 @@ test('filter', async () => { }, ['test/basic.test.ts']) expect(stderr).toBe('') - expect(stdout).toContain('✓ test/basic.test.ts > basic 2') - expect(stdout).toContain('Test Files 1 passed') - expect(stdout).toContain('Tests 1 passed | 3 skipped') + instances.forEach(({ browser }) => { + expect(stdout).toReportPassedTest('test/basic.test.ts > basic 2', browser) + }) + expect(stdout).toContain(`Test Files ${instances.length} passed`) + expect(stdout).toContain(`Tests ${instances.length} passed | ${instances.length * 3} skipped`) }) diff --git a/test/browser/specs/fix-4686.test.ts b/test/browser/specs/fix-4686.test.ts index 85e9e0af2e3b..bbc1846d96e0 100644 --- a/test/browser/specs/fix-4686.test.ts +++ b/test/browser/specs/fix-4686.test.ts @@ -1,10 +1,10 @@ // fix #4686 import { expect, test } from 'vitest' -import { runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' test('tests run in presence of config.base', async () => { - const { stderr, ctx } = await runBrowserTests( + const { stderr, stdout } = await runBrowserTests( { config: './vitest.config-basepath.mts', }, @@ -12,13 +12,8 @@ test('tests run in presence of config.base', async () => { ) expect(stderr).toBe('') - expect( - Object.fromEntries( - ctx.state.getFiles().map(f => [f.name, f.result.state]), - ), - ).toMatchInlineSnapshot(` - { - "test/basic.test.ts": "pass", - } - `) + + instances.forEach(({ browser }) => { + expect(stdout).toContain(`✓ |${browser}| test/basic.test.ts`) + }) }) diff --git a/test/browser/specs/inspect.test.ts b/test/browser/specs/inspect.test.ts index b186d10889e2..efc063984fbc 100644 --- a/test/browser/specs/inspect.test.ts +++ b/test/browser/specs/inspect.test.ts @@ -6,10 +6,10 @@ import { runVitestCli } from '../../test-utils' type Message = Partial> -const IS_PLAYWRIGHT_CHROMIUM = process.env.BROWSER === 'chromium' && process.env.PROVIDER === 'playwright' +const IS_PLAYWRIGHT = process.env.PROVIDER === 'playwright' const REMOTE_DEBUG_URL = '127.0.0.1:9123' -test.runIf(IS_PLAYWRIGHT_CHROMIUM || !process.env.CI)('--inspect-brk stops at test file', async () => { +test.runIf(IS_PLAYWRIGHT || !process.env.CI)('--inspect-brk stops at test file', async () => { const { vitest, waitForClose } = await runVitestCli( '--root', 'fixtures/inspect', diff --git a/test/browser/specs/locators.test.ts b/test/browser/specs/locators.test.ts index 753926422536..55003c55ab7b 100644 --- a/test/browser/specs/locators.test.ts +++ b/test/browser/specs/locators.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import { runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' test('locators work correctly', async () => { const { stderr, stdout } = await runBrowserTests({ @@ -7,8 +7,13 @@ test('locators work correctly', async () => { reporters: [['verbose', { isTTY: false }]], }) - expect(stderr).toBe('') - expect(stdout).toContain('✓ blog.test.tsx') - expect(stdout).toContain('✓ query.test.ts') - expect(stdout).toContain('Test Files 2 passed (2)') + expect(stderr).toReportNoErrors() + + instances.forEach(({ browser }) => { + expect(stdout).toReportPassedTest('blog.test.tsx', browser) + expect(stdout).toReportPassedTest('query.test.ts', browser) + }) + + expect(stdout).toReportSummaryTestFiles({ passed: instances.length * 2 }) + expect(stdout).toReportSummaryTests({ passed: instances.length * 3 }) }) diff --git a/test/browser/specs/mocking.test.ts b/test/browser/specs/mocking.test.ts index a42fc91957fd..1f2a8855fcc3 100644 --- a/test/browser/specs/mocking.test.ts +++ b/test/browser/specs/mocking.test.ts @@ -1,5 +1,6 @@ import { expect, onTestFailed, onTestFinished, test } from 'vitest' import { editFile, runVitest } from '../../test-utils' +import { instances } from '../settings' test.each([true, false])('mocking works correctly - isolated %s', async (isolate) => { const result = await runVitest({ @@ -12,19 +13,23 @@ test.each([true, false])('mocking works correctly - isolated %s', async (isolate console.error(result.stderr) }) - expect(result.stderr).toBe('') - expect(result.stdout).toContain('automocked.test.ts') - expect(result.stdout).toContain('mocked-__mocks__.test.ts') - expect(result.stdout).toContain('mocked-factory.test.ts') - expect(result.stdout).toContain('mocked-factory-hoisted.test.ts') - expect(result.stdout).toContain('not-mocked.test.ts') - expect(result.stdout).toContain('mocked-nested.test.ts') - expect(result.stdout).toContain('not-mocked-nested.test.ts') - expect(result.stdout).toContain('import-actual-in-mock.test.ts') - expect(result.stdout).toContain('import-actual-query.test.ts') - expect(result.stdout).toContain('import-mock.test.ts') - expect(result.stdout).toContain('mocked-do-mock-factory.test.ts') - expect(result.stdout).toContain('import-actual-dep.test.ts') + expect(result.stderr).toReportNoErrors() + + instances.forEach(({ browser }) => { + expect(result.stdout).toReportPassedTest('automocked.test.ts', browser) + expect(result.stdout).toReportPassedTest('mocked-__mocks__.test.ts', browser) + expect(result.stdout).toReportPassedTest('mocked-factory.test.ts', browser) + expect(result.stdout).toReportPassedTest('mocked-factory-hoisted.test.ts', browser) + expect(result.stdout).toReportPassedTest('not-mocked.test.ts', browser) + expect(result.stdout).toReportPassedTest('mocked-nested.test.ts', browser) + expect(result.stdout).toReportPassedTest('not-mocked-nested.test.ts', browser) + expect(result.stdout).toReportPassedTest('import-actual-in-mock.test.ts', browser) + expect(result.stdout).toReportPassedTest('import-actual-query.test.ts', browser) + expect(result.stdout).toReportPassedTest('import-mock.test.ts', browser) + expect(result.stdout).toReportPassedTest('mocked-do-mock-factory.test.ts', browser) + expect(result.stdout).toReportPassedTest('import-actual-dep.test.ts', browser) + }) + expect(result.exitCode).toBe(0) }) @@ -35,21 +40,26 @@ test('mocking dependency correctly invalidates it on rerun', async () => { }) onTestFinished(async () => { await ctx.close() - await ctx.closingPromise }) await vitest.waitForStdout('Waiting for file changes...') - expect(vitest.stderr).toBe('') - expect(vitest.stdout).toContain('1_mocked-on-watch-change.test.ts') - expect(vitest.stdout).toContain('2_not-mocked-import.test.ts') + expect(vitest.stderr).toReportNoErrors() + + instances.forEach(({ browser }) => { + expect(vitest.stdout).toReportPassedTest('1_mocked-on-watch-change.test.ts', browser) + expect(vitest.stdout).toReportPassedTest('2_not-mocked-import.test.ts', browser) + }) vitest.resetOutput() editFile('./fixtures/mocking-watch/1_mocked-on-watch-change.test.ts', content => `${content}\n`) await vitest.waitForStdout('Waiting for file changes...') - expect(vitest.stderr).toBe('') - expect(vitest.stdout).toContain('1_mocked-on-watch-change.test.ts') - expect(vitest.stdout).not.toContain('2_not-mocked-import.test.ts') + expect(vitest.stderr).toReportNoErrors() + + instances.forEach(({ browser }) => { + expect(vitest.stdout).toReportPassedTest('1_mocked-on-watch-change.test.ts', browser) + expect(vitest.stdout).not.toReportPassedTest('2_not-mocked-import.test.ts', browser) + }) }) diff --git a/test/browser/specs/multiple-different-configs.test.ts b/test/browser/specs/multiple-different-configs.test.ts new file mode 100644 index 000000000000..48cd36e4a1a2 --- /dev/null +++ b/test/browser/specs/multiple-different-configs.test.ts @@ -0,0 +1,25 @@ +import { expect, test } from 'vitest' +import { provider } from '../settings' +import { runBrowserTests } from './utils' + +test.runIf(provider === 'playwright')('[playwright] runs multiple different configurations correctly', async () => { + const { stdout, exitCode, stderr } = await runBrowserTests({ + root: './fixtures/multiple-different-configs', + }) + + expect(stderr).toBe('') + expect(exitCode).toBe(0) + expect(stdout).toContain('[chromium] HTML_INJECTED_VAR is true') + expect(stdout).toContain('[firefox] HTML_INJECTED_VAR is undefined') +}) + +test.runIf(provider === 'webdriverio')('[webdriverio] runs multiple different configurations correctly', async () => { + const { stdout, exitCode, stderr } = await runBrowserTests({ + root: './fixtures/multiple-different-configs', + }) + + expect(stderr).toBe('') + expect(exitCode).toBe(0) + expect(stdout).toContain('[chromium] HTML_INJECTED_VAR is true') + expect(stdout).toContain('[firefox] HTML_INJECTED_VAR is undefined') +}) diff --git a/test/browser/specs/runner.test.ts b/test/browser/specs/runner.test.ts index 4ccc02129dbe..64dfaafdb0e2 100644 --- a/test/browser/specs/runner.test.ts +++ b/test/browser/specs/runner.test.ts @@ -1,6 +1,6 @@ import { readFile } from 'node:fs/promises' import { beforeAll, describe, expect, onTestFailed, test } from 'vitest' -import { browser, provider, runBrowserTests } from './utils' +import { instances, provider, runBrowserTests } from './utils' describe('running browser tests', async () => { let stderr: string @@ -28,9 +28,9 @@ describe('running browser tests', async () => { console.error(stderr) }) - expect(browserResultJson.testResults).toHaveLength(19) - expect(passedTests).toHaveLength(17) - expect(failedTests).toHaveLength(2) + expect(browserResultJson.testResults).toHaveLength(19 * instances.length) + expect(passedTests).toHaveLength(17 * instances.length) + expect(failedTests).toHaveLength(2 * instances.length) expect(stderr).not.toContain('optimized dependencies changed') expect(stderr).not.toContain('has been externalized for browser compatibility') @@ -89,7 +89,7 @@ describe('running browser tests', async () => { expect(stderr).toMatch(/hello from console.trace\s+(\w+|@)/) }) - test.runIf(browser !== 'webkit')(`logs have stack traces in non-safari`, () => { + test(`logs have stack traces`, () => { expect(stdout).toMatch(` log with a stack ❯ test/logs.test.ts:58:10 @@ -100,20 +100,20 @@ error with a stack `.trim()) // console.trace processes the stack trace correctly expect(stderr).toMatch('test/logs.test.ts:60:10') - }) - test.runIf(browser === 'webkit')(`logs have stack traces in safari`, () => { + if (instances.some(({ browser }) => browser === 'webkit')) { // safari print stack trace in a different place - expect(stdout).toMatch(` + expect(stdout).toMatch(` log with a stack ❯ test/logs.test.ts:58:14 `.trim()) - expect(stderr).toMatch(` + expect(stderr).toMatch(` error with a stack ❯ test/logs.test.ts:59:16 `.trim()) - // console.trace processes the stack trace correctly - expect(stderr).toMatch('test/logs.test.ts:60:16') + // console.trace processes the stack trace correctly + expect(stderr).toMatch('test/logs.test.ts:60:16') + } }) test(`stack trace points to correct file in every browser`, () => { @@ -141,17 +141,15 @@ error with a stack }) test('user-event', async () => { - const { ctx } = await runBrowserTests({ + const { stdout } = await runBrowserTests({ root: './fixtures/user-event', }) - expect(Object.fromEntries(ctx.state.getFiles().map(f => [f.name, f.result.state]))).toMatchInlineSnapshot(` - { - "cleanup-retry.test.ts": "pass", - "cleanup1.test.ts": "pass", - "cleanup2.test.ts": "pass", - "keyboard.test.ts": "pass", - } - `) + instances.forEach(({ browser }) => { + expect(stdout).toReportPassedTest('cleanup-retry.test.ts', browser) + expect(stdout).toReportPassedTest('cleanup1.test.ts', browser) + expect(stdout).toReportPassedTest('cleanup2.test.ts', browser) + expect(stdout).toReportPassedTest('keyboard.test.ts', browser) + }) }) test('timeout', async () => { diff --git a/test/browser/specs/server-url.test.ts b/test/browser/specs/server-url.test.ts index 153cbd1cba55..0a1c5a5d5fc3 100644 --- a/test/browser/specs/server-url.test.ts +++ b/test/browser/specs/server-url.test.ts @@ -1,5 +1,5 @@ import { afterEach, expect, test } from 'vitest' -import { runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' afterEach(() => { delete process.env.TEST_HTTPS @@ -24,5 +24,5 @@ test('server-url https', async () => { expect(stderr).toBe('') const url = ctx?.projects[0].browser?.vite.resolvedUrls?.local[0] expect(url).toBe('https://localhost:51122/') - expect(stdout).toContain('Test Files 1 passed') + expect(stdout).toReportSummaryTestFiles({ passed: instances.length }) }) diff --git a/test/browser/specs/setup-file.test.ts b/test/browser/specs/setup-file.test.ts index bdf97071bbe5..73699beb1b6e 100644 --- a/test/browser/specs/setup-file.test.ts +++ b/test/browser/specs/setup-file.test.ts @@ -1,23 +1,18 @@ // fix https://github.com/vitest-dev/vitest/issues/6690 import { expect, test } from 'vitest' -import { runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' test('setup file imports the same modules', async () => { - const { stderr, ctx } = await runBrowserTests( + const { stderr, stdout } = await runBrowserTests( { root: './fixtures/setup-file', }, ) - expect(stderr).toBe('') - expect( - Object.fromEntries( - ctx.state.getFiles().map(f => [f.name, f.result.state]), - ), - ).toMatchInlineSnapshot(` - { - "module-equality.test.ts": "pass", - } - `) + expect(stderr).toReportNoErrors() + + instances.forEach(({ browser }) => { + expect(stdout).toReportPassedTest('module-equality.test.ts', browser) + }) }) diff --git a/test/browser/specs/unhandled.test.ts b/test/browser/specs/unhandled.test.ts index a45ed8da2997..c05ebc95a2a1 100644 --- a/test/browser/specs/unhandled.test.ts +++ b/test/browser/specs/unhandled.test.ts @@ -1,15 +1,14 @@ import { expect, test } from 'vitest' -import { browser, runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' test('prints correct unhandled error stack', async () => { const { stderr } = await runBrowserTests({ root: './fixtures/unhandled', }) - if (browser === 'webkit') { + expect(stderr).toContain('throw-unhandled-error.test.ts:9:10') + + if (instances.some(({ browser }) => browser === 'webkit')) { expect(stderr).toContain('throw-unhandled-error.test.ts:9:20') } - else { - expect(stderr).toContain('throw-unhandled-error.test.ts:9:10') - } }) diff --git a/test/browser/specs/update-snapshot.test.ts b/test/browser/specs/update-snapshot.test.ts index 688d776874b4..d61ad03fb72d 100644 --- a/test/browser/specs/update-snapshot.test.ts +++ b/test/browser/specs/update-snapshot.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs' import { expect, onTestFailed, onTestFinished, test } from 'vitest' import { createFile, editFile } from '../../test-utils' -import { runBrowserTests } from './utils' +import { instances, runBrowserTests } from './utils' test('update snapshot', async () => { // setup wrong snapshot value @@ -15,6 +15,7 @@ test('update snapshot', async () => { const ctx = await runBrowserTests({ watch: true, root: './fixtures/update-snapshot', + project: [instances[0].browser], // TODO 2024-12-11 Sheremet V.A. test with multiple browsers reporters: ['default'], // use simple reporter to not pollute stdout browser: { headless: true }, }, [], { diff --git a/test/browser/specs/utils.ts b/test/browser/specs/utils.ts index 2b29e55d7a69..f46242609e6e 100644 --- a/test/browser/specs/utils.ts +++ b/test/browser/specs/utils.ts @@ -1,9 +1,9 @@ import type { UserConfig as ViteUserConfig } from 'vite' import type { UserConfig } from 'vitest/node' import { runVitest } from '../../test-utils' +import { browser } from '../settings' -export const provider = process.env.PROVIDER || 'playwright' -export const browser = process.env.BROWSER || (provider !== 'playwright' ? 'chromium' : 'chrome') +export { browser, instances, provider } from '../settings' export async function runBrowserTests( config?: Omit & { browser?: Partial }, diff --git a/test/browser/tsconfig.json b/test/browser/tsconfig.json index 083a747ea373..fe4b26cb6b5f 100644 --- a/test/browser/tsconfig.json +++ b/test/browser/tsconfig.json @@ -13,5 +13,12 @@ "vitest/import-meta" ], "esModuleInterop": true - } + }, + "include": [ + "fixtures/**/*.ts", + "test/**/*.ts", + "specs/**/*.ts", + "./vitest.config.*", + "./setup.unit.ts" + ] } diff --git a/test/browser/vitest.config.mts b/test/browser/vitest.config.mts index d252d3c91e51..0436736e63ec 100644 --- a/test/browser/vitest.config.mts +++ b/test/browser/vitest.config.mts @@ -1,4 +1,4 @@ -import type { BrowserCommand } from 'vitest/node' +import type { BrowserCommand, BrowserInstanceOption } from 'vitest/node' import { dirname, resolve } from 'node:path' import { fileURLToPath } from 'node:url' import * as util from 'node:util' @@ -19,6 +19,21 @@ const stripVTControlCharacters: BrowserCommand<[text: string]> = (_, text) => { return util.stripVTControlCharacters(text) } +const devInstances: BrowserInstanceOption[] = [ + { browser }, +] + +const playwrightInstances: BrowserInstanceOption[] = [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, +] + +const webdriverioInstances: BrowserInstanceOption[] = [ + { browser: 'chrome' }, + { browser: 'firefox' }, +] + export default defineConfig({ server: { headers: { @@ -38,8 +53,12 @@ export default defineConfig({ snapshotEnvironment: './custom-snapshot-env.ts', browser: { enabled: true, - name: browser, headless: false, + instances: process.env.BROWSER + ? devInstances + : provider === 'playwright' + ? playwrightInstances + : webdriverioInstances, provider, isolate: false, testerScripts: [ diff --git a/test/browser/vitest.config.unit.mts b/test/browser/vitest.config.unit.mts index 0618ce0ca59a..8bcb174b0ae8 100644 --- a/test/browser/vitest.config.unit.mts +++ b/test/browser/vitest.config.unit.mts @@ -8,7 +8,9 @@ export default defineConfig({ singleFork: true, }, }, - hookTimeout: process.env.CI ? 120_000 : 20_000, - testTimeout: process.env.CI ? 120_000 : 20_000, + setupFiles: ['./setup.unit.ts'], + // 3 is the maximum of browser instances - in a perfect world they will run in parallel + hookTimeout: process.env.CI ? 120_000 * 3 : 20_000, + testTimeout: process.env.CI ? 120_000 * 3 : 20_000, }, }) diff --git a/test/cli/test/__snapshots__/list.test.ts.snap b/test/cli/test/__snapshots__/list.test.ts.snap index efc6f0b467ad..2dc10a05972d 100644 --- a/test/cli/test/__snapshots__/list.test.ts.snap +++ b/test/cli/test/__snapshots__/list.test.ts.snap @@ -20,12 +20,12 @@ Error: describe error `; exports[`correctly outputs all tests with args: "--browser.enabled" 1`] = ` -"basic.test.ts > basic suite > inner suite > some test -basic.test.ts > basic suite > inner suite > another test -basic.test.ts > basic suite > basic test -basic.test.ts > outside test -math.test.ts > 1 plus 1 -math.test.ts > failing test +"[chromium] basic.test.ts > basic suite > inner suite > some test +[chromium] basic.test.ts > basic suite > inner suite > another test +[chromium] basic.test.ts > basic suite > basic test +[chromium] basic.test.ts > outside test +[chromium] math.test.ts > 1 plus 1 +[chromium] math.test.ts > failing test " `; diff --git a/test/config/fixtures/bail/vitest.config.ts b/test/config/fixtures/bail/vitest.config.ts index f117ebe338a0..0a7dfa7957b9 100644 --- a/test/config/fixtures/bail/vitest.config.ts +++ b/test/config/fixtures/bail/vitest.config.ts @@ -29,8 +29,10 @@ export default defineConfig({ }, browser: { headless: true, - name: 'chrome', provider: 'webdriverio', + instances: [ + { browser: 'chrome' }, + ], }, }, }) diff --git a/test/config/test/bail.test.ts b/test/config/test/bail.test.ts index d03c1b0cedc9..5fc1e72db67d 100644 --- a/test/config/test/bail.test.ts +++ b/test/config/test/bail.test.ts @@ -4,24 +4,32 @@ import { expect, test } from 'vitest' import { runVitest } from '../../test-utils' const configs: UserConfig[] = [] -const pools: UserConfig[] = [{ pool: 'threads' }, { pool: 'forks' }, { pool: 'threads', poolOptions: { threads: { singleThread: true } } }] +const pools: UserConfig[] = [ + { pool: 'threads' }, + { pool: 'forks' }, + { pool: 'threads', poolOptions: { threads: { singleThread: true } } }, +] if (process.platform !== 'win32') { pools.push( { browser: { enabled: true, - name: 'chromium', provider: 'playwright', fileParallelism: false, + instances: [ + { browser: 'chromium' }, + ], }, }, { browser: { enabled: true, - name: 'chromium', provider: 'playwright', fileParallelism: true, + instances: [ + { browser: 'chromium' }, + ], }, }, ) @@ -61,7 +69,7 @@ for (const config of configs) { // THREADS here means that multiple tests are run parallel process.env.THREADS = isParallel ? 'true' : 'false' - const { exitCode, stdout } = await runVitest({ + const { exitCode, stdout, ctx } = await runVitest({ root: './fixtures/bail', bail: 1, ...config, @@ -70,9 +78,20 @@ for (const config of configs) { }, }) + expect(ctx?.config.pool).toBe(config.pool || 'forks') + expect(ctx?.config.browser.enabled).toBe(config.browser?.enabled ?? false) + + const browser = config.browser?.enabled + expect(exitCode).toBe(1) - expect(stdout).toMatch('✓ test/first.test.ts > 1 - first.test.ts - this should pass') - expect(stdout).toMatch('× test/first.test.ts > 2 - first.test.ts - this should fail') + if (browser) { + expect(stdout).toMatch(`✓ |chromium| test/first.test.ts > 1 - first.test.ts - this should pass`) + expect(stdout).toMatch(`× |chromium| test/first.test.ts > 2 - first.test.ts - this should fail`) + } + else { + expect(stdout).toMatch('✓ test/first.test.ts > 1 - first.test.ts - this should pass') + expect(stdout).toMatch('× test/first.test.ts > 2 - first.test.ts - this should fail') + } // Cancelled tests should not be run expect(stdout).not.toMatch('test/first.test.ts > 3 - first.test.ts - this should be skipped') diff --git a/test/config/test/browser-configs.test.ts b/test/config/test/browser-configs.test.ts new file mode 100644 index 000000000000..efdd91b47396 --- /dev/null +++ b/test/config/test/browser-configs.test.ts @@ -0,0 +1,177 @@ +import type { ViteUserConfig } from 'vitest/config' +import type { UserConfig, VitestOptions } from 'vitest/node' +import { expect, test } from 'vitest' +import { createVitest } from 'vitest/node' + +async function vitest(cliOptions: UserConfig, configValue: UserConfig = {}, viteConfig: ViteUserConfig = {}, vitestOptions: VitestOptions = {}) { + return await createVitest('test', { ...cliOptions, watch: false }, { ...viteConfig, test: configValue as any }, vitestOptions) +} + +test('assignes names as browsers', async () => { + const { projects } = await vitest({ + browser: { + enabled: true, + headless: true, + instances: [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, + ], + }, + }) + expect(projects.map(p => p.name)).toEqual([ + 'chromium', + 'firefox', + 'webkit', + ]) +}) + +test('filters projects', async () => { + const { projects } = await vitest({ + project: 'chromium', + browser: { + enabled: true, + instances: [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, + ], + }, + }) + expect(projects.map(p => p.name)).toEqual([ + 'chromium', + ]) +}) + +test('filters projects with a wildecard', async () => { + const { projects } = await vitest({ + project: 'chrom*', + browser: { + enabled: true, + instances: [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, + ], + }, + }) + expect(projects.map(p => p.name)).toEqual([ + 'chromium', + ]) +}) + +test('assignes names as browsers in a custom project', async () => { + const { projects } = await vitest({ + workspace: [ + { + test: { + name: 'custom', + browser: { + enabled: true, + headless: true, + instances: [ + { browser: 'chromium' }, + { browser: 'firefox' }, + { browser: 'webkit' }, + { browser: 'webkit', name: 'hello-world' }, + ], + }, + }, + }, + ], + }) + expect(projects.map(p => p.name)).toEqual([ + 'custom (chromium)', + 'custom (firefox)', + 'custom (webkit)', + 'hello-world', + ]) +}) + +test('inherits browser options', async () => { + const { projects } = await vitest({ + setupFiles: ['/test/setup.ts'], + provide: { + browser: true, + } as any, + browser: { + enabled: true, + headless: true, + screenshotFailures: false, + testerHtmlPath: '/custom-path.html', + screenshotDirectory: '/custom-directory', + fileParallelism: false, + viewport: { + width: 300, + height: 900, + }, + locators: { + testIdAttribute: 'data-tid', + }, + instances: [ + { + browser: 'chromium', + screenshotFailures: true, + }, + { + browser: 'firefox', + screenshotFailures: true, + locators: { + testIdAttribute: 'data-custom', + }, + viewport: { + width: 900, + height: 300, + }, + testerHtmlPath: '/custom-overriden-path.html', + screenshotDirectory: '/custom-overriden-directory', + }, + ], + }, + }) + expect(projects.map(p => p.config)).toMatchObject([ + { + name: 'chromium', + setupFiles: ['/test/setup.ts'], + provide: { + browser: true, + } as any, + browser: { + enabled: true, + headless: true, + screenshotFailures: true, + screenshotDirectory: '/custom-directory', + viewport: { + width: 300, + height: 900, + }, + locators: { + testIdAttribute: 'data-tid', + }, + fileParallelism: false, + testerHtmlPath: '/custom-path.html', + }, + }, + { + name: 'firefox', + setupFiles: ['/test/setup.ts'], + provide: { + browser: true, + } as any, + browser: { + enabled: true, + headless: true, + screenshotFailures: true, + viewport: { + width: 900, + height: 300, + }, + screenshotDirectory: '/custom-overriden-directory', + locators: { + testIdAttribute: 'data-custom', + }, + testerHtmlPath: '/custom-overriden-path.html', + }, + }, + ]) +}) diff --git a/test/config/test/browser-html.test.ts b/test/config/test/browser-html.test.ts index 19abfc738cdc..93f31b8563de 100644 --- a/test/config/test/browser-html.test.ts +++ b/test/config/test/browser-html.test.ts @@ -26,10 +26,10 @@ test('allows correct custom html', async () => { const { stderr, stdout, exitCode } = await runVitest({ root, config: './vitest.config.correct.ts', - reporters: ['basic'], + reporters: [['default', { summary: false }]], }) expect(stderr).toBe('') - expect(stdout).toContain('✓ browser-basic.test.ts') + expect(stdout).toContain('✓ |chromium| browser-basic.test.ts') expect(exitCode).toBe(0) }) @@ -37,10 +37,10 @@ test('allows custom transformIndexHtml with custom html file', async () => { const { stderr, stdout, exitCode } = await runVitest({ root, config: './vitest.config.custom-transformIndexHtml.ts', - reporters: ['basic'], + reporters: [['default', { summary: false }]], }) expect(stderr).toBe('') - expect(stdout).toContain('✓ browser-custom.test.ts') + expect(stdout).toContain('✓ |chromium| browser-custom.test.ts') expect(exitCode).toBe(0) }) @@ -48,9 +48,9 @@ test('allows custom transformIndexHtml without custom html file', async () => { const { stderr, stdout, exitCode } = await runVitest({ root, config: './vitest.config.default-transformIndexHtml.ts', - reporters: ['basic'], + reporters: [['default', { summary: false }]], }) expect(stderr).toBe('') - expect(stdout).toContain('✓ browser-custom.test.ts') + expect(stdout).toContain('✓ |chromium| browser-custom.test.ts') expect(exitCode).toBe(0) }) diff --git a/test/config/test/failures.test.ts b/test/config/test/failures.test.ts index 407ace135c85..74a42e121db2 100644 --- a/test/config/test/failures.test.ts +++ b/test/config/test/failures.test.ts @@ -289,6 +289,102 @@ test('maxConcurrency 0 prints a warning', async () => { expect(stderr).toMatch('The option "maxConcurrency" cannot be set to 0. Using default value 5 instead.') }) +test('browser.name or browser.instances are required', async () => { + const { stderr, exitCode } = await runVitestCli('--browser.enabled') + expect(exitCode).toBe(1) + expect(stderr).toMatch('Vitest Browser Mode requires "browser.name" (deprecated) or "browser.instances" options, none were set.') +}) + +test('browser.instances is empty', async () => { + const { stderr } = await runVitest({ + browser: { + enabled: true, + provider: 'playwright', + instances: [], + }, + }) + expect(stderr).toMatch('"browser.instances" was set in the config, but the array is empty. Define at least one browser config.') +}) + +test('browser.name filteres all browser.instances are required', async () => { + const { stderr } = await runVitest({ + browser: { + enabled: true, + name: 'chromium', + provider: 'playwright', + instances: [ + { browser: 'firefox' }, + ], + }, + }) + expect(stderr).toMatch('"browser.instances" was set in the config, but the array is empty. Define at least one browser config. The "browser.name" was set to "chromium" which filtered all configs (firefox). Did you mean to use another name?') +}) + +test('browser.instances throws an error if no custom name is provided', async () => { + const { stderr } = await runVitest({ + browser: { + enabled: true, + provider: 'playwright', + instances: [ + { browser: 'firefox' }, + { browser: 'firefox' }, + ], + }, + }) + expect(stderr).toMatch('Cannot define a nested project for a firefox browser. The project name "firefox" was already defined. If you have multiple instances for the same browser, make sure to define a custom "name". All projects in a workspace should have unique names. Make sure your configuration is correct.') +}) + +test('browser.instances throws an error if no custom name is provided, but the config name is inherited', async () => { + const { stderr } = await runVitest({ + name: 'custom', + browser: { + enabled: true, + provider: 'playwright', + instances: [ + { browser: 'firefox' }, + { browser: 'firefox' }, + ], + }, + }) + expect(stderr).toMatch('Cannot define a nested project for a firefox browser. The project name "custom (firefox)" was already defined. If you have multiple instances for the same browser, make sure to define a custom "name". All projects in a workspace should have unique names. Make sure your configuration is correct.') +}) + +test('throws an error if name conflicts with a workspace name', async () => { + const { stderr } = await runVitest({ + workspace: [ + { test: { name: '1 (firefox)' } }, + { + test: { + browser: { + enabled: true, + provider: 'playwright', + instances: [ + { browser: 'firefox' }, + ], + }, + }, + }, + ], + }) + expect(stderr).toMatch('Cannot define a nested project for a firefox browser. The project name "1 (firefox)" was already defined. If you have multiple instances for the same browser, make sure to define a custom "name". All projects in a workspace should have unique names. Make sure your configuration is correct.') +}) + +test('throws an error if several browsers are headed in nonTTY mode', async () => { + const { stderr } = await runVitest({ + browser: { + enabled: true, + provider: 'playwright', + headless: false, + instances: [ + { browser: 'chromium' }, + { browser: 'firefox' }, + ], + }, + }) + expect(stderr).toContain('Found multiple projects that run browser tests in headed mode: "chromium", "firefox"') + expect(stderr).toContain('Please, filter projects with --browser=name or --project=name flag or run tests with "headless: true" option') +}) + test('non existing project name will throw', async () => { const { stderr } = await runVitest({ project: 'non-existing-project' }) expect(stderr).toMatch('No projects matched the filter "non-existing-project".') diff --git a/test/coverage-test/fixtures/configs/vitest.config.thresholds-auto-update.ts b/test/coverage-test/fixtures/configs/vitest.config.thresholds-auto-update.ts index ca57c233a41e..57dd4a621946 100644 --- a/test/coverage-test/fixtures/configs/vitest.config.thresholds-auto-update.ts +++ b/test/coverage-test/fixtures/configs/vitest.config.thresholds-auto-update.ts @@ -9,14 +9,14 @@ export default defineConfig({ // Global ones lines: 0.1, functions: 0.2, - branches: 0.3, - statements: 0.4, + branches: -1000, + statements: -2000, '**/src/math.ts': { branches: 0.1, functions: 0.2, - lines: 0.3, - statements: 0.4 + lines: -1000, + statements: -2000, } } } diff --git a/test/coverage-test/test/isolation.test.ts b/test/coverage-test/test/isolation.test.ts index 8c8cd3c89896..15b05965e40e 100644 --- a/test/coverage-test/test/isolation.test.ts +++ b/test/coverage-test/test/isolation.test.ts @@ -31,7 +31,6 @@ for (const isolate of [true, false]) { reporter: ['json', 'html'], }, - // @ts-expect-error -- merged in runVitest browser: { isolate, }, diff --git a/test/coverage-test/test/threshold-auto-update.test.ts b/test/coverage-test/test/threshold-auto-update.test.ts index f39ea10158b9..529b0c64087a 100644 --- a/test/coverage-test/test/threshold-auto-update.test.ts +++ b/test/coverage-test/test/threshold-auto-update.test.ts @@ -20,14 +20,14 @@ test('thresholds.autoUpdate updates thresholds', async () => { // Global ones lines: 0.1, functions: 0.2, - branches: 0.3, - statements: 0.4, + branches: -1000, + statements: -2000, '**/src/math.ts': { branches: 0.1, functions: 0.2, - lines: 0.3, - statements: 0.4 + lines: -1000, + statements: -2000, } } } @@ -56,13 +56,13 @@ test('thresholds.autoUpdate updates thresholds', async () => { lines: 55.55, functions: 33.33, branches: 100, - statements: 55.55, + statements: -8, '**/src/math.ts': { branches: 100, functions: 25, - lines: 50, - statements: 50 + lines: -6, + statements: -6, } } } @@ -84,13 +84,13 @@ test('thresholds.autoUpdate updates thresholds', async () => { lines: 33.33, functions: 33.33, branches: 100, - statements: 33.33, + statements: -4, '**/src/math.ts': { branches: 100, functions: 25, - lines: 25, - statements: 25 + lines: -3, + statements: -3, } } } diff --git a/test/coverage-test/test/threshold-failure.test.ts b/test/coverage-test/test/threshold-failure.test.ts index 6b461b1a24d3..0b66ed6201b9 100644 --- a/test/coverage-test/test/threshold-failure.test.ts +++ b/test/coverage-test/test/threshold-failure.test.ts @@ -2,7 +2,7 @@ import { expect } from 'vitest' import { sum } from '../fixtures/src/math' import { coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils' -test('failing thresholds', async () => { +test('failing percentage thresholds', async () => { const { exitCode, stderr } = await runVitest({ include: [normalizeURL(import.meta.url)], coverage: { @@ -28,6 +28,36 @@ test('failing thresholds', async () => { expect(stderr).toContain('ERROR: Coverage for functions (25%) does not meet "**/fixtures/src/math.ts" threshold (100%)') }) +test('failing absolute thresholds', async () => { + const { exitCode, stderr } = await runVitest({ + include: [normalizeURL(import.meta.url)], + coverage: { + all: false, + include: ['**/fixtures/src/math.ts'], + thresholds: { + '**/fixtures/src/math.ts': { + branches: -1, + functions: -2, + lines: -5, + statements: -1, + }, + }, + }, + }, { throwOnError: false }) + + expect(exitCode).toBe(1) + + if (isV8Provider()) { + expect(stderr).toContain('ERROR: Uncovered lines (6) exceed "**/fixtures/src/math.ts" threshold (5)') + expect(stderr).toContain('ERROR: Uncovered functions (3) exceed "**/fixtures/src/math.ts" threshold (2)') + expect(stderr).toContain('ERROR: Uncovered statements (6) exceed "**/fixtures/src/math.ts" threshold (1)') + } + else { + expect(stderr).toContain('ERROR: Uncovered functions (3) exceed "**/fixtures/src/math.ts" threshold (2)') + expect(stderr).toContain('ERROR: Uncovered statements (3) exceed "**/fixtures/src/math.ts" threshold (1)') + } +}) + coverageTest('cover some lines, but not too much', () => { expect(sum(1, 2)).toBe(3) }) diff --git a/test/reporters/fixtures/long-loading-task.test.ts b/test/reporters/fixtures/long-loading-task.test.ts new file mode 100644 index 000000000000..11aa80554e53 --- /dev/null +++ b/test/reporters/fixtures/long-loading-task.test.ts @@ -0,0 +1,5 @@ +import { test } from 'vitest' + +await new Promise(r => setTimeout(r, 500)) + +test('works') diff --git a/test/reporters/tests/default.test.ts b/test/reporters/tests/default.test.ts index 23b3dcafedf5..52eb3e23fdbb 100644 --- a/test/reporters/tests/default.test.ts +++ b/test/reporters/tests/default.test.ts @@ -70,6 +70,20 @@ describe('default reporter', async () => { expect(result.stderr).not.toContain(`status: 'not found'`) }) + test('prints queued tests as soon as they are added', async () => { + const { stdout, vitest } = await runVitest({ + include: ['fixtures/long-loading-task.test.ts'], + reporters: [['default', { isTTY: true, summary: true }]], + config: 'fixtures/vitest.config.ts', + watch: true, + }) + + await vitest.waitForStdout('❯ fixtures/long-loading-task.test.ts [queued]') + await vitest.waitForStdout('Waiting for file changes...') + + expect(stdout).toContain('✓ fixtures/long-loading-task.test.ts (1 test)') + }) + test('prints skipped tests by default when a single file is run', async () => { const { stdout } = await runVitest({ include: ['fixtures/all-passing-or-skipped.test.ts'], diff --git a/test/test-utils/index.ts b/test/test-utils/index.ts index cf4eb1e793e9..85b4cbf4c0f2 100644 --- a/test/test-utils/index.ts +++ b/test/test-utils/index.ts @@ -134,7 +134,11 @@ export async function runVitest( } } -export async function runCli(command: string, _options?: Partial | string, ...args: string[]) { +interface CliOptions extends Partial { + earlyReturn?: boolean +} + +export async function runCli(command: string, _options?: CliOptions | string, ...args: string[]) { let options = _options if (typeof _options === 'string') { @@ -172,7 +176,7 @@ export async function runCli(command: string, _options?: Partial | stri await isDone }) - if (args.includes('--inspect') || args.includes('--inspect-brk')) { + if ((options as CliOptions)?.earlyReturn || args.includes('--inspect') || args.includes('--inspect-brk')) { return output() } @@ -192,12 +196,12 @@ export async function runCli(command: string, _options?: Partial | stri return output() } -export async function runVitestCli(_options?: Partial | string, ...args: string[]) { +export async function runVitestCli(_options?: CliOptions | string, ...args: string[]) { process.env.VITE_TEST_WATCHER_DEBUG = 'true' return runCli('vitest', _options, ...args) } -export async function runViteNodeCli(_options?: Partial | string, ...args: string[]) { +export async function runViteNodeCli(_options?: CliOptions | string, ...args: string[]) { process.env.VITE_TEST_WATCHER_DEBUG = 'true' const { vitest, ...rest } = await runCli('vite-node', _options, ...args) diff --git a/tsconfig.check.json b/tsconfig.check.json index 2a9e09dc9daf..fe3fa7d051bb 100644 --- a/tsconfig.check.json +++ b/tsconfig.check.json @@ -14,6 +14,7 @@ "./packages/ui/client/**", "./examples/**/*.*", "./bench/**", + "./test/benchmark/fixtures/**", "./test/typescript/**", "./test/browser/**", "**/coverage/fixtures/**",