From 57d23cec43422328b857dcf820f0f876dd87d48b Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 23 Jul 2024 14:52:21 +0200 Subject: [PATCH] docs: fix inconsistencies, remove low informative twoslash examples (#6200) --- docs/.vitepress/config.ts | 11 +- docs/.vitepress/scripts/cli-generator.ts | 45 +- docs/advanced/api.md | 6 +- docs/advanced/pool.md | 4 +- docs/advanced/reporters.md | 2 +- docs/advanced/runner.md | 4 +- docs/api/expect-typeof.md | 62 +- docs/api/expect.md | 99 ++- docs/api/index.md | 73 +- docs/api/mock.md | 40 +- docs/api/vi.md | 86 +-- docs/config/file.md | 4 +- docs/config/index.md | 8 + docs/guide/cli-generated.md | 828 +++++++++++++++++++++ docs/guide/cli-table.md | 126 ---- docs/guide/cli.md | 31 +- docs/guide/coverage.md | 17 +- docs/guide/environment.md | 6 +- docs/guide/features.md | 33 +- docs/guide/filtering.md | 10 +- docs/guide/index.md | 20 +- docs/guide/migration.md | 13 +- docs/guide/mocking.md | 10 +- docs/guide/reporters.md | 15 +- docs/guide/snapshot.md | 43 +- docs/guide/test-context.md | 6 +- docs/guide/workspace.md | 2 +- docs/package.json | 2 +- eslint.config.js | 2 + packages/runner/src/hooks.ts | 18 +- packages/runner/src/suite.ts | 24 +- packages/vitest/src/integrations/vi.ts | 18 +- packages/vitest/src/node/cli/cli-config.ts | 4 +- pnpm-lock.yaml | 595 +++++++-------- test/typescript/test-d/test.test-d.ts | 4 +- 35 files changed, 1461 insertions(+), 810 deletions(-) create mode 100644 docs/guide/cli-generated.md delete mode 100644 docs/guide/cli-table.md diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index c87d8730c..112abf201 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -60,7 +60,16 @@ export default ({ mode }: { mode: string }) => { light: 'github-light', dark: 'github-dark', }, - codeTransformers: mode === 'development' ? [] : [transformerTwoslash()], + codeTransformers: mode === 'development' + ? [] + : [transformerTwoslash({ + processHoverInfo: (info) => { + if (info.includes(process.cwd())) { + return info.replace(new RegExp(process.cwd(), 'g'), '') + } + return info + }, + })], }, themeConfig: { logo: '/logo.svg', diff --git a/docs/.vitepress/scripts/cli-generator.ts b/docs/.vitepress/scripts/cli-generator.ts index 1223e3b24..864972792 100644 --- a/docs/.vitepress/scripts/cli-generator.ts +++ b/docs/.vitepress/scripts/cli-generator.ts @@ -5,10 +5,37 @@ import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cl import { cliOptionsConfig } from '../../../packages/vitest/src/node/cli/cli-config' const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..') -const cliTablePath = resolve(docsDir, './guide/cli-table.md') +const cliTablePath = resolve(docsDir, './guide/cli-generated.md') const nonNullable = (value: T): value is NonNullable => value !== null && value !== undefined +const skipCli = new Set([ + 'mergeReports', + 'changed', + 'shard', +]) + +const skipConfig = new Set([ + 'config', + 'api.port', + 'api.host', + 'api.strictPort', + 'coverage.watermarks.statements', + 'coverage.watermarks.lines', + 'coverage.watermarks.branches', + 'coverage.watermarks.functions', + 'coverage.thresholds.statements', + 'coverage.thresholds.branches', + 'coverage.thresholds.functions', + 'coverage.thresholds.lines', + 'standalone', + 'clearScreen', + 'color', + 'run', + 'hideSkippedTests', + 'dom', +]) + function resolveOptions(options: CLIOptions, parentName?: string) { return Object.entries(options).flatMap( ([subcommandName, subcommandConfig]) => resolveCommand( @@ -19,7 +46,7 @@ function resolveOptions(options: CLIOptions, parentName?: string) { } function resolveCommand(name: string, config: CLIOption | null): any { - if (!config) { + if (!config || skipCli.has(name)) { return null } @@ -37,17 +64,19 @@ function resolveCommand(name: string, config: CLIOption | null): any { } return { - title, + title: name, + cli: title, description: config.description, } } const options = resolveOptions(cliOptionsConfig) -const template = ` -| Options | | -| ------------- | ------------- | -${options.map(({ title, description }) => `| ${title} | ${description} |`).join('\n')} -`.trimStart() +const template = options.map((option) => { + const title = option.title + const cli = option.cli + const config = skipConfig.has(title) ? '' : `[${title}](/config/#${title.toLowerCase().replace(/\./g, '-')})` + return `### ${title}\n\n- **CLI:** ${cli}\n${config ? `- **Config:** ${config}\n` : ''}\n${option.description}\n` +}).join('\n') writeFileSync(cliTablePath, template, 'utf-8') diff --git a/docs/advanced/api.md b/docs/advanced/api.md index 3152dbfd8..5429a84f0 100644 --- a/docs/advanced/api.md +++ b/docs/advanced/api.md @@ -8,7 +8,7 @@ Vitest exposes experimental private API. Breaking changes might not follow SemVe You can start running Vitest tests using its Node API: -```js twoslash +```js import { startVitest } from 'vitest/node' const vitest = await startVitest('test') @@ -38,7 +38,7 @@ Alternatively, you can pass in the complete Vite config as the fourth argument, You can create Vitest instance yourself using `createVitest` function. It returns the same `Vitest` instance as `startVitest`, but it doesn't start tests and doesn't validate installed packages. -```js twoslash +```js import { createVitest } from 'vitest/node' const vitest = await createVitest('test', { @@ -50,7 +50,7 @@ const vitest = await createVitest('test', { You can use this method to parse CLI arguments. It accepts a string (where arguments are split by a single space) or a strings array of CLI arguments in the same format that Vitest CLI uses. It returns a filter and `options` that you can later pass down to `createVitest` or `startVitest` methods. -```ts twoslash +```ts import { parseCLI } from 'vitest/node' parseCLI('vitest ./files.ts --coverage --browser=chrome') diff --git a/docs/advanced/pool.md b/docs/advanced/pool.md index 0024e60d2..2d5309be4 100644 --- a/docs/advanced/pool.md +++ b/docs/advanced/pool.md @@ -14,9 +14,9 @@ Vitest runs tests in pools. By default, there are several pools: You can provide your own pool by specifying a file path: -```ts twoslash +```ts import { defineConfig } from 'vitest/config' -// ---cut--- + export default defineConfig({ test: { // will run every file with a custom pool by default diff --git a/docs/advanced/reporters.md b/docs/advanced/reporters.md index c316447c5..208ca767d 100644 --- a/docs/advanced/reporters.md +++ b/docs/advanced/reporters.md @@ -6,7 +6,7 @@ You can import reporters from `vitest/reporters` and extend them to create your In general, you don't need to create your reporter from scratch. `vitest` comes with several default reporting programs that you can extend. -```ts twoslash +```ts import { DefaultReporter } from 'vitest/reporters' export default class MyDefaultReporter extends DefaultReporter { diff --git a/docs/advanced/runner.md b/docs/advanced/runner.md index 7b724b217..da8bf1a99 100644 --- a/docs/advanced/runner.md +++ b/docs/advanced/runner.md @@ -110,7 +110,7 @@ Snapshot support and some other features depend on the runner. If you don't want You can extend Vitest task system with your tasks. A task is an object that is part of a suite. It is automatically added to the current suite with a `suite.task` method: -```js twoslash +```js // ./utils/custom.js import { createTaskCollector, getCurrentSuite, setFn } from 'vitest/suite' @@ -134,7 +134,7 @@ export const myCustomTask = createTaskCollector( ) ``` -```js twoslash +```js // ./garden/tasks.test.js import { afterAll, beforeAll, describe, myCustomTask } from '../custom.js' import { gardener } from './gardener.js' diff --git a/docs/api/expect-typeof.md b/docs/api/expect-typeof.md index 4857acd57..d3fce9ce7 100644 --- a/docs/api/expect-typeof.md +++ b/docs/api/expect-typeof.md @@ -18,7 +18,7 @@ You can negate all assertions, using `.not` property. This matcher will check if the types are fully equal to each other. This matcher will not fail if two objects have different values, but the same type. It will fail however if an object is missing a property. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() @@ -33,13 +33,13 @@ expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() This matcher checks if expect type extends provided type. It is different from `toEqual` and is more similar to [expect's](/api/expect) `toMatchObject()`. With this matcher, you can check if an object “matches” a type. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 1 }) expectTypeOf().toMatchTypeOf() expectTypeOf().not.toMatchTypeOf() - ``` +``` ## extract @@ -47,7 +47,7 @@ expectTypeOf().not.toMatchTypeOf() You can use `.extract` to narrow down types for further testing. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' type ResponsiveProp = T | T[] | { xs?: T; sm?: T; md?: T } @@ -79,7 +79,7 @@ If no type is found in the union, `.extract` will return `never`. You can use `.exclude` to remove types from a union for further testing. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' type ResponsiveProp = T | T[] | { xs?: T; sm?: T; md?: T } @@ -108,7 +108,7 @@ If no type is found in the union, `.exclude` will return `never`. You can use `.returns` to extract return value of a function type. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(() => {}).returns.toBeVoid() @@ -125,7 +125,7 @@ If used on a non-function type, it will return `never`, so you won't be able to You can extract function arguments with `.parameters` to perform assertions on its value. Parameters are returned as an array. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' type NoParam = () => void @@ -149,7 +149,7 @@ You can also use [`.toBeCallableWith`](#tobecallablewith) matcher as a more expr You can extract a certain function argument with `.parameter(number)` call to perform other assertions on it. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' function foo(a: number, b: string) { @@ -170,7 +170,7 @@ If used on a non-function type, it will return `never`, so you won't be able to You can extract constructor parameters as an array of values and perform assertions on them with this method. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(Date).constructorParameters.toEqualTypeOf<[] | [string | number | Date]>() @@ -190,7 +190,7 @@ You can also use [`.toBeConstructibleWith`](#tobeconstructiblewith) matcher as a This property gives access to matchers that can be performed on an instance of the provided class. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(Date).instance.toHaveProperty('toISOString') @@ -206,7 +206,7 @@ If used on a non-function type, it will return `never`, so you won't be able to You can get array item type with `.items` to perform further assertions. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf([1, 2, 3]).items.toEqualTypeOf() @@ -219,7 +219,7 @@ expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf() This matcher extracts resolved value of a `Promise`, so you can perform other assertions on it. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' async function asyncFunc() { @@ -240,7 +240,7 @@ If used on a non-promise type, it will return `never`, so you won't be able to c This matcher extracts guard value (e.g., `v is number`), so you can perform assertions on it. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' function isString(v: any): v is string { @@ -259,7 +259,7 @@ Returns `never`, if the value is not a guard function, so you won't be able to c This matcher extracts assert value (e.g., `assert v is number`), so you can perform assertions on it. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' function assertNumber(v: any): asserts v is number { @@ -281,7 +281,7 @@ Returns `never`, if the value is not an assert function, so you won't be able to With this matcher you can check, if provided type is `any` type. If the type is too specific, the test will fail. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf().toBeAny() @@ -295,7 +295,7 @@ expectTypeOf('string').not.toBeAny() This matcher checks, if provided type is `unknown` type. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf().toBeUnknown() @@ -335,7 +335,7 @@ expectTypeOf((): never => {}).toBeFunction() This matcher checks, if provided type is an `object`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(42).not.toBeObject() @@ -348,7 +348,7 @@ expectTypeOf({}).toBeObject() This matcher checks, if provided type is `Array`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(42).not.toBeArray() @@ -363,7 +363,7 @@ expectTypeOf([{}, 42]).toBeArray() This matcher checks, if provided type is a `string`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(42).not.toBeString() @@ -377,7 +377,7 @@ expectTypeOf('a').toBeString() This matcher checks, if provided type is `boolean`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(42).not.toBeBoolean() @@ -391,7 +391,7 @@ expectTypeOf().toBeBoolean() This matcher checks, if provided type is `void`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(() => {}).returns.toBeVoid() @@ -404,7 +404,7 @@ expectTypeOf().toBeVoid() This matcher checks, if provided type is a `symbol`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(Symbol(1)).toBeSymbol() @@ -417,7 +417,7 @@ expectTypeOf().toBeSymbol() This matcher checks, if provided type is `null`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(null).toBeNull() @@ -431,7 +431,7 @@ expectTypeOf(undefined).not.toBeNull() This matcher checks, if provided type is `undefined`. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(undefined).toBeUndefined() @@ -445,12 +445,12 @@ expectTypeOf(null).not.toBeUndefined() This matcher checks, if you can use `null` or `undefined` with provided type. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' -expectTypeOf<1 | undefined>().toBeNullable() -expectTypeOf<1 | null>().toBeNullable() -expectTypeOf<1 | undefined | null>().toBeNullable() +expectTypeOf().toBeNullable() +expectTypeOf().toBeNullable() +expectTypeOf().toBeNullable() ``` ## toBeCallableWith @@ -459,7 +459,7 @@ expectTypeOf<1 | undefined | null>().toBeNullable() This matcher ensures you can call provided function with a set of parameters. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' type NoParam = () => void @@ -479,7 +479,7 @@ If used on a non-function type, it will return `never`, so you won't be able to This matcher ensures you can create a new instance with a set of constructor parameters. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' expectTypeOf(Date).toBeConstructibleWith(new Date()) @@ -496,7 +496,7 @@ If used on a non-function type, it will return `never`, so you won't be able to This matcher checks if a property exists on the provided object. If it exists, it also returns the same set of matchers for the type of this property, so you can chain assertions one after another. -```ts twoslash +```ts import { expectTypeOf } from 'vitest' const obj = { a: 1, b: '' } diff --git a/docs/api/expect.md b/docs/api/expect.md index d61b99d8a..caa88491d 100644 --- a/docs/api/expect.md +++ b/docs/api/expect.md @@ -33,19 +33,19 @@ Also, `expect` can be used statically to access matcher functions, described lat `expect.soft` functions similarly to `expect`, but instead of terminating the test execution upon a failed assertion, it continues running and marks the failure as a test failure. All errors encountered during the test will be displayed until the test is completed. -```ts twoslash +```ts import { expect, test } from 'vitest' test('expect.soft test', () => { expect.soft(1 + 1).toBe(3) // mark the test as fail and continue expect.soft(1 + 2).toBe(4) // mark the test as fail and continue }) -// At the end of the test, the above errors will be output. +// reporter will report both errors at the end of the run ``` It can also be used with `expect`. if `expect` assertion fails, the test will be terminated and all errors will be displayed. -```ts twoslash +```ts import { expect, test } from 'vitest' test('expect.soft test', () => { @@ -67,12 +67,7 @@ test('expect.soft test', () => { If an error is thrown inside the `expect.poll` callback, Vitest will retry again until the timeout runs out. -```ts twoslash -function asyncInjectElement() { - // example function -} - -// ---cut--- +```ts import { expect, test } from 'vitest' test('element exists', async () => { @@ -104,7 +99,7 @@ expect(flakyValue).toMatchSnapshot() Using `not` will negate the assertion. For example, this code asserts that an `input` value is not equal to `2`. If it's equal, the assertion will throw an error, and the test will fail. -```ts twoslash +```ts import { expect, test } from 'vitest' const input = Math.sqrt(16) @@ -121,7 +116,7 @@ expect(input).not.toBe(2) // jest API For example, the code below checks if the trader has 13 apples. -```ts twoslash +```ts import { expect, test } from 'vitest' const stock = { @@ -149,7 +144,7 @@ Try not to use `toBe` with floating-point numbers. Since JavaScript rounds them, Use `toBeCloseTo` to compare floating-point numbers. The optional `numDigits` argument limits the number of digits to check _after_ the decimal point. For example: -```ts twoslash +```ts import { expect, test } from 'vitest' test.fails('decimals are not equal in javascript', () => { @@ -170,7 +165,7 @@ test('decimals are rounded to 5 after the point', () => { `toBeDefined` asserts that the value is not equal to `undefined`. Useful use case would be to check if function _returned_ anything. -```ts twoslash +```ts import { expect, test } from 'vitest' function getApples() { @@ -188,7 +183,7 @@ test('function returned something', () => { Opposite of `toBeDefined`, `toBeUndefined` asserts that the value _is_ equal to `undefined`. Useful use case would be to check if function hasn't _returned_ anything. -```ts twoslash +```ts import { expect, test } from 'vitest' function getApplesFromStock(stock: string) { @@ -276,7 +271,7 @@ Everything in JavaScript is truthy, except `false`, `null`, `undefined`, `NaN`, `toBeNull` simply asserts if something is `null`. Alias for `.toBe(null)`. -```ts twoslash +```ts import { expect, test } from 'vitest' function apples() { @@ -294,7 +289,7 @@ test('we don\'t have apples', () => { `toBeNaN` simply asserts if something is `NaN`. Alias for `.toBe(NaN)`. -```ts twoslash +```ts import { expect, test } from 'vitest' let i = 0 @@ -316,7 +311,7 @@ test('getApplesCount has some unusual side effects...', () => { `toBeTypeOf` asserts if an actual value is of type of received type. -```ts twoslash +```ts import { expect, test } from 'vitest' const actual = 'stock' @@ -409,7 +404,7 @@ test('have 11 apples or less', () => { `toEqual` asserts if actual value is equal to received one or has the same structure, if it is an object (compares them recursively). You can see the difference between `toEqual` and [`toBe`](#tobe) in this example: -```ts twoslash +```ts import { expect, test } from 'vitest' const stockBill = { @@ -505,7 +500,7 @@ test('apple available', () => { `toHaveLength` asserts if an object has a `.length` property and it is set to a certain numeric value. -```ts twoslash +```ts import { expect, test } from 'vitest' test('toHaveLength', () => { @@ -525,7 +520,7 @@ test('toHaveLength', () => { You can provide an optional value argument also known as deep equality, like the `toEqual` matcher to compare the received property value. -```ts twoslash +```ts import { expect, test } from 'vitest' const invoice = { @@ -579,7 +574,7 @@ test('John Doe Invoice', () => { `toMatch` asserts if a string matches a regular expression or a string. -```ts twoslash +```ts import { expect, test } from 'vitest' test('top fruits', () => { @@ -596,7 +591,7 @@ test('top fruits', () => { You can also pass an array of objects. This is useful if you want to check that two arrays match in their number of elements, as opposed to `arrayContaining`, which allows for extra elements in the received array. -```ts twoslash +```ts import { expect, test } from 'vitest' const johnInvoice = { @@ -659,7 +654,7 @@ You must wrap the code in a function, otherwise the error will not be caught, an For example, if we want to test that `getFruitStock('pineapples')` throws, we could write: -```ts twoslash +```ts import { expect, test } from 'vitest' function getFruitStock(type: string) { @@ -685,7 +680,7 @@ test('throws on pineapples', () => { :::tip To test async functions, use in combination with [rejects](#rejects). -```js twoslash +```js function getAsyncFruitStock() { return Promise.reject(new Error('empty')) } @@ -708,7 +703,7 @@ You can provide an optional `hint` string argument that is appended to the test When snapshot mismatch and causing the test failing, if the mismatch is expected, you can press `u` key to update the snapshot for once. Or you can pass `-u` or `--update` CLI options to make Vitest always update the tests. ::: -```ts twoslash +```ts import { expect, test } from 'vitest' test('matches snapshot', () => { @@ -719,7 +714,7 @@ test('matches snapshot', () => { You can also provide a shape of an object, if you are testing just a shape of an object, and don't need it to be 100% compatible: -```ts twoslash +```ts import { expect, test } from 'vitest' test('matches snapshot', () => { @@ -736,7 +731,7 @@ This ensures that a value matches the most recent snapshot. Vitest adds and updates the inlineSnapshot string argument to the matcher in the test file (instead of an external `.snap` file). -```ts twoslash +```ts import { expect, test } from 'vitest' test('matches inline snapshot', () => { @@ -755,7 +750,7 @@ test('matches inline snapshot', () => { You can also provide a shape of an object, if you are testing just a shape of an object, and don't need it to be 100% compatible: -```ts twoslash +```ts import { expect, test } from 'vitest' test('matches snapshot', () => { @@ -806,7 +801,7 @@ The same as [`toMatchInlineSnapshot`](#tomatchinlinesnapshot), but expects the s This assertion is useful for testing that a function has been called. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' const market = { @@ -832,7 +827,7 @@ test('spy function', () => { This assertion checks if a function was called a certain amount of times. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' const market = { @@ -857,7 +852,7 @@ test('spy function called two times', () => { This assertion checks if a function was called at least once with certain parameters. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' const market = { @@ -883,7 +878,7 @@ test('spy function', () => { This assertion checks if a function was called with certain parameters at its last invocation. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' const market = { @@ -911,7 +906,7 @@ This assertion checks if a function was called with certain parameters at the ce Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' const market = { @@ -936,7 +931,7 @@ test('first call of spy function called with right params', () => { This assertion checks if a function has successfully returned a value at least once (i.e., did not throw an error). Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' function getApplesPrice(amount: number) { @@ -960,7 +955,7 @@ test('spy function returned a value', () => { This assertion checks if a function has successfully returned a value an exact amount of times (i.e., did not throw an error). Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function returns a value two times', () => { @@ -979,7 +974,7 @@ test('spy function returns a value two times', () => { You can call this assertion to check if a function has successfully returned a value with certain parameters at least once. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function returns a product', () => { @@ -997,7 +992,7 @@ test('spy function returns a product', () => { You can call this assertion to check if a function has successfully returned a certain value when it was last invoked. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function returns bananas on a last call', () => { @@ -1016,7 +1011,7 @@ test('spy function returns bananas on a last call', () => { You can call this assertion to check if a function has successfully returned a value with certain parameters on a certain call. Requires a spy function to be passed to `expect`. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function returns bananas on second call', () => { @@ -1037,13 +1032,7 @@ This assertion checks if a function has successfully resolved a value at least o If the function returned a promise, but it was not resolved yet, this will fail. -```ts twoslash -// @filename: db/apples.js -/** @type {any} */ -const db = {} -export default db -// @filename: test.ts -// ---cut--- +```ts import { expect, test, vi } from 'vitest' import db from './db/apples.js' @@ -1069,7 +1058,7 @@ This assertion checks if a function has successfully resolved a value an exact a This will only count resolved promises. If the function returned a promise, but it was not resolved yet, it will not be counted. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function resolved a value two times', async () => { @@ -1090,7 +1079,7 @@ You can call this assertion to check if a function has successfully resolved a c If the function returned a promise, but it was not resolved yet, this will fail. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function resolved a product', async () => { @@ -1110,7 +1099,7 @@ You can call this assertion to check if a function has successfully resolved a c If the function returned a promise, but it was not resolved yet, this will fail. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function resolves bananas on a last call', async () => { @@ -1131,7 +1120,7 @@ You can call this assertion to check if a function has successfully resolved a c If the function returned a promise, but it was not resolved yet, this will fail. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('spy function returns bananas on second call', async () => { @@ -1150,7 +1139,7 @@ test('spy function returns bananas on second call', async () => { This assertion checks if a value satisfies a certain predicate. -```ts twoslash +```ts import { describe, expect, it } from 'vitest' describe('toSatisfy()', () => { const isOdd = (value: number) => value % 2 !== 0 @@ -1395,7 +1384,7 @@ test('compare float in object properties', () => { When used with an equality check, this asymmetric matcher will return `true` if the value is an array and contains specified items. -```ts twoslash +```ts import { expect, test } from 'vitest' test('basket includes fuji', () => { @@ -1424,7 +1413,7 @@ You can use `expect.not` with this matcher to negate the expected value. When used with an equality check, this asymmetric matcher will return `true` if the value has a similar shape. -```ts twoslash +```ts import { expect, test } from 'vitest' test('basket has empire apples', () => { @@ -1454,7 +1443,7 @@ You can use `expect.not` with this matcher to negate the expected value. When used with an equality check, this asymmetric matcher will return `true` if the value is a string and contains a specified substring. -```ts twoslash +```ts import { expect, test } from 'vitest' test('variety has "Emp" in its name', () => { @@ -1479,7 +1468,7 @@ You can use `expect.not` with this matcher to negate the expected value. When used with an equality check, this asymmetric matcher will return `true` if the value is a string and contains a specified substring or if the string matches a regular expression. -```ts twoslash +```ts import { expect, test } from 'vitest' test('variety ends with "re"', () => { @@ -1571,7 +1560,7 @@ If you want to know more, checkout [guide on extending matchers](/guide/extendin You can use this method to define custom testers, which are methods used by matchers, to test if two objects are equal. It is compatible with Jest's `expect.addEqualityTesters`. -```ts twoslash +```ts import { expect, test } from 'vitest' class AnagramComparator { diff --git a/docs/api/index.md b/docs/api/index.md index 7af5f6c7d..3a9b89deb 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -50,14 +50,14 @@ In Jest, `TestFunction` can also be of type `(done: DoneCallback) => void`. If t Most options support both dot-syntax and object-syntax allowing you to use whatever style you prefer. :::code-group -```ts [dot-syntax] twoslash +```ts [dot-syntax] import { test } from 'vitest' test.skip('skipped test', () => { // some logic that fails right now }) ``` -```ts [object-syntax] twoslash +```ts [object-syntax] import { test } from 'vitest' test('skipped test', { skip: true }, () => { @@ -74,7 +74,7 @@ test('skipped test', { skip: true }, () => { Optionally, you can provide a timeout (in milliseconds) for specifying how long to wait before terminating. The default is 5 seconds, and can be configured globally with [testTimeout](/config/#testtimeout) -```ts twoslash +```ts import { expect, test } from 'vitest' test('should work as expected', () => { @@ -117,7 +117,7 @@ myTest('add item', ({ todos }) => { If you want to skip running certain tests, but you don't want to delete the code due to any reason, you can use `test.skip` to avoid running them. -```ts twoslash +```ts import { assert, test } from 'vitest' test.skip('skipped test', () => { @@ -128,7 +128,7 @@ test.skip('skipped test', () => { You can also skip test by calling `skip` on its [context](/guide/test-context) dynamically: -```ts twoslash +```ts import { assert, test } from 'vitest' test('skipped test', (context) => { @@ -144,7 +144,7 @@ test('skipped test', (context) => { In some cases you might run tests multiple times with different environments, and some of the tests might be environment-specific. Instead of wrapping the test code with `if`, you can use `test.skipIf` to skip the test whenever the condition is truthy. -```ts twoslash +```ts import { assert, test } from 'vitest' const isDev = process.env.NODE_ENV === 'development' @@ -164,7 +164,7 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t Opposite of [test.skipIf](#test-skipif). -```ts twoslash +```ts import { assert, test } from 'vitest' const isDev = process.env.NODE_ENV === 'development' @@ -186,7 +186,7 @@ Use `test.only` to only run certain tests in a given suite. This is useful when Optionally, you can provide a timeout (in milliseconds) for specifying how long to wait before terminating. The default is 5 seconds, and can be configured globally with [testTimeout](/config/#testtimeout). -```ts twoslash +```ts import { assert, test } from 'vitest' test.only('test', () => { @@ -208,7 +208,7 @@ In order to do that run `vitest` with specific file containing the tests in ques `test.concurrent` marks consecutive tests to be run in parallel. It receives the test name, an async function with the tests to collect, and an optional timeout (in milliseconds). -```ts twoslash +```ts import { describe, test } from 'vitest' // The two tests marked with concurrent will be run in parallel @@ -249,10 +249,9 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t `test.sequential` marks a test as sequential. This is useful if you want to run tests in sequence within `describe.concurrent` or with the `--sequence.concurrent` command option. -```ts twoslash +```ts import { describe, test } from 'vitest' -// ---cut--- // with config option { sequence: { concurrent: true } } test('concurrent test 1', async () => { /* ... */ }) test('concurrent test 2', async () => { /* ... */ }) @@ -287,7 +286,7 @@ test.todo('unimplemented test') Use `test.fails` to indicate that an assertion will fail explicitly. -```ts twoslash +```ts import { expect, test } from 'vitest' function myAsyncFunc() { @@ -323,10 +322,9 @@ You can inject parameters with [printf formatting](https://nodejs.org/api/util.h - `%#`: index of the test case - `%%`: single percent sign ('%') -```ts twoslash +```ts import { expect, test } from 'vitest' -// ---cut--- test.each([ [1, 1, 2], [1, 2, 3], @@ -381,10 +379,9 @@ Starting from Vitest 0.25.3, you can also use template string table. * First row should be column names, separated by `|`; * One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. -```ts twoslash +```ts import { expect, test } from 'vitest' -// ---cut--- test.each` a | b | expected ${1} | ${1} | ${2} @@ -454,7 +451,7 @@ test.concurrent.for([ Vitest uses [`tinybench`](https://github.com/tinylibs/tinybench) library under the hood, inheriting all its options that can be used as a third argument. -```ts twoslash +```ts import { bench } from 'vitest' bench('normal sorting', () => { @@ -519,7 +516,7 @@ export interface Options { You can use `bench.skip` syntax to skip running certain benchmarks. -```ts twoslash +```ts import { bench } from 'vitest' bench.skip('normal sorting', () => { @@ -536,7 +533,7 @@ bench.skip('normal sorting', () => { Use `bench.only` to only run certain benchmarks in a given suite. This is useful when debugging. -```ts twoslash +```ts import { bench } from 'vitest' bench.only('normal sorting', () => { @@ -553,7 +550,7 @@ bench.only('normal sorting', () => { Use `bench.todo` to stub benchmarks to be implemented later. -```ts twoslash +```ts import { bench } from 'vitest' bench.todo('unimplemented test') @@ -563,7 +560,7 @@ bench.todo('unimplemented test') When you use `test` or `bench` in the top level of file, they are collected as part of the implicit suite for it. Using `describe` you can define a new suite in the current context, as a set of related tests or benchmarks and other nested suites. A suite lets you organize your tests and benchmarks so reports are more clear. -```ts twoslash +```ts // basic.spec.ts // organizing tests @@ -589,7 +586,7 @@ describe('person', () => { }) ``` -```ts twoslash +```ts // basic.bench.ts // organizing benchmarks @@ -614,7 +611,7 @@ describe('sort', () => { You can also nest describe blocks if you have a hierarchy of tests or benchmarks: -```ts twoslash +```ts import { describe, expect, test } from 'vitest' function numberToCurrency(value: number | string) { @@ -646,7 +643,7 @@ describe('numberToCurrency', () => { Use `describe.skip` in a suite to avoid running a particular describe block. -```ts twoslash +```ts import { assert, describe, test } from 'vitest' describe.skip('skipped suite', () => { @@ -663,7 +660,7 @@ describe.skip('skipped suite', () => { In some cases, you might run suites multiple times with different environments, and some of the suites might be environment-specific. Instead of wrapping the suite with `if`, you can use `describe.skipIf` to skip the suite whenever the condition is truthy. -```ts twoslash +```ts import { describe, test } from 'vitest' const isDev = process.env.NODE_ENV === 'development' @@ -683,7 +680,7 @@ You cannot use this syntax when using Vitest as [type checker](/guide/testing-ty Opposite of [describe.skipIf](#describe-skipif). -```ts twoslash +```ts import { assert, describe, test } from 'vitest' const isDev = process.env.NODE_ENV === 'development' @@ -703,9 +700,9 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t Use `describe.only` to only run certain suites -```ts twoslash +```ts import { assert, describe, test } from 'vitest' -// ---cut--- + // Only this suite (and others marked with only) are run describe.only('suite', () => { test('sqrt', () => { @@ -731,9 +728,9 @@ In order to do that run `vitest` with specific file containing the tests in ques `describe.concurrent` runs all inner suites and tests in parallel -```ts twoslash +```ts import { describe, test } from 'vitest' -// ---cut--- + // All suites and tests within this suite will be run in parallel describe.concurrent('suite', () => { test('concurrent test 1', async () => { /* ... */ }) @@ -777,9 +774,9 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t `describe.sequential` in a suite marks every test as sequential. This is useful if you want to run tests in sequence within `describe.concurrent` or with the `--sequence.concurrent` command option. -```ts twoslash +```ts import { describe, test } from 'vitest' -// ---cut--- + describe.concurrent('suite', () => { test('concurrent test 1', async () => { /* ... */ }) test('concurrent test 2', async () => { /* ... */ }) @@ -797,9 +794,9 @@ describe.concurrent('suite', () => { Vitest provides a way to run all tests in random order via CLI flag [`--sequence.shuffle`](/guide/cli) or config option [`sequence.shuffle`](/config/#sequence-shuffle), but if you want to have only part of your test suite to run tests in random order, you can mark it with this flag. -```ts twoslash +```ts import { describe, test } from 'vitest' -// ---cut--- + describe.shuffle('suite', () => { test('random test 1', async () => { /* ... */ }) test('random test 2', async () => { /* ... */ }) @@ -831,9 +828,9 @@ describe.todo('unimplemented suite') Use `describe.each` if you have more than one test that depends on the same data. -```ts twoslash +```ts import { describe, expect, test } from 'vitest' -// ---cut--- + describe.each([ { a: 1, b: 1, expected: 2 }, { a: 1, b: 2, expected: 3 }, @@ -858,9 +855,9 @@ Starting from Vitest 0.25.3, you can also use template string table. * First row should be column names, separated by `|`; * One or more subsequent rows of data supplied as template literal expressions using `${value}` syntax. -```ts twoslash +```ts import { describe, expect, test } from 'vitest' -// ---cut--- + describe.each` a | b | expected ${1} | ${1} | ${2} diff --git a/docs/api/mock.md b/docs/api/mock.md index 4addb63fc..17843f0d6 100644 --- a/docs/api/mock.md +++ b/docs/api/mock.md @@ -56,9 +56,7 @@ Sets internal mock name. Useful to see the name of the mock if assertion fails. Accepts a function that will be used as an implementation of the mock. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const mockFn = vi.fn().mockImplementation((apples: number) => apples + 1) // or: vi.fn(apples => apples + 1); @@ -78,9 +76,7 @@ mockFn.mock.calls[1][0] === 1 // true Accepts a function that will be used as mock's implementation during the next call. Can be chained so that multiple function calls produce different results. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const myMockFn = vi .fn() .mockImplementationOnce(() => true) @@ -92,9 +88,7 @@ myMockFn() // false When the mocked function runs out of implementations, it will invoke the default implementation that was set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called: -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const myMockFn = vi .fn(() => 'default') .mockImplementationOnce(() => 'first call') @@ -111,9 +105,7 @@ console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn()) Overrides the original mock implementation temporarily while the callback is being executed. -```js twoslash -import { vi } from 'vitest' -// ---cut--- +```js const myMockFn = vi.fn(() => 'original') myMockFn.withImplementation(() => 'temp', () => { @@ -149,9 +141,7 @@ Note that this method takes precedence over the [`mockImplementationOnce`](#mock Accepts an error that will be rejected when async function is called. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const asyncMock = vi.fn().mockRejectedValue(new Error('Async error')) await asyncMock() // throws "Async error" @@ -163,9 +153,7 @@ await asyncMock() // throws "Async error" Accepts a value that will be rejected during the next function call. If chained, every consecutive call will reject specified value. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const asyncMock = vi .fn() .mockResolvedValueOnce('first call') @@ -199,9 +187,7 @@ If you want this method to be called before each test automatically, you can ena Accepts a value that will be resolved when async function is called. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const asyncMock = vi.fn().mockResolvedValue(42) await asyncMock() // 42 @@ -213,9 +199,7 @@ await asyncMock() // 42 Accepts a value that will be resolved during the next function call. If chained, every consecutive call will resolve specified value. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const asyncMock = vi .fn() .mockResolvedValue('default') @@ -246,9 +230,7 @@ spy.mockImplementation(function () { Accepts a value that will be returned whenever the mock function is called. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const mock = vi.fn() mock.mockReturnValue(42) mock() // 42 @@ -264,9 +246,7 @@ Accepts a value that will be returned during the next function call. If chained, When there are no more `mockReturnValueOnce` values to use, mock will fallback to previously defined implementation if there is one. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts const myMockFn = vi .fn() .mockReturnValue('default') diff --git a/docs/api/vi.md b/docs/api/vi.md index 4f2d967b1..47a94b99d 100644 --- a/docs/api/vi.md +++ b/docs/api/vi.md @@ -31,45 +31,21 @@ Vitest will not mock modules that were imported inside a [setup file](/config/#s If `factory` is defined, all imports will return its result. Vitest calls factory only once and caches results for all subsequent imports until [`vi.unmock`](#vi-unmock) or [`vi.doUnmock`](#vi-dounmock) is called. -Unlike in `jest`, the factory can be asynchronous. You can use [`vi.importActual`](#vi-importactual) or a helper with the factory passed in as the first argument, and get the original module inside. +Unlike in `jest`, the factory can be asynchronous. You can use [`vi.importActual`](#vi-importactual) or a helper with the factory passed in as the first argument, and get the original module inside. Vitest also supports a module promise instead of a string in `vi.mock` method for better IDE support (when file is moved, path will be updated, `importOriginal` also inherits the type automatically). -```js twoslash +```ts twoslash +// @filename: ./path/to/module.js +export declare function total(...numbers: number[]): number +// @filename: test.js import { vi } from 'vitest' // ---cut--- -// when using JavaScript - -vi.mock('./path/to/module.js', async (importOriginal) => { - const mod = await importOriginal() - return { - ...mod, - // replace some exports - namedExport: vi.fn(), - } -}) -``` - -```ts -// when using TypeScript - -vi.mock('./path/to/module.js', async (importOriginal) => { - const mod = await importOriginal() - return { - ...mod, - // replace some exports - namedExport: vi.fn(), - } -}) -``` - -Vitest supports a module promise instead of a string in `vi.mock` method for better IDE support (when file is moved, path will be updated, `importOriginal` also inherits the type automatically). - -```ts vi.mock(import('./path/to/module.js'), async (importOriginal) => { const mod = await importOriginal() // type is inferred + // ^? return { ...mod, // replace some exports - namedExport: vi.fn(), + total: vi.fn(), } }) ``` @@ -363,9 +339,7 @@ This section describes how to work with [method mocks](/api/mock) and replace en Creates a spy on a function, though can be initiated without one. Every time a function is invoked, it stores its call arguments, returns, and instances. Also, you can manipulate its behavior with [methods](/api/mock). If no function is given, mock will return `undefined`, when invoked. -```ts twoslash -import { expect, vi } from 'vitest' -// ---cut--- +```ts const getApples = vi.fn(() => 0) getApples() @@ -404,9 +378,7 @@ Will call [`.mockRestore()`](/api/mock#mockrestore) on all spies. This will clea Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](#vi-fn). It returns a [mock function](/api/mock). -```ts twoslash -import { expect, vi } from 'vitest' -// ---cut--- +```ts let apples = 0 const cart = { getApples: () => 42, @@ -502,7 +474,7 @@ import.meta.env.NODE_ENV === 'development' Changes the value of global variable. You can restore its original value by calling `vi.unstubAllGlobals`. -```ts twoslash +```ts import { vi } from 'vitest' // `innerWidth` is "0" before calling stubGlobal @@ -564,9 +536,7 @@ This sections descibes how to work with [fake timers](/guide/mocking#timers). This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts let i = 0 setInterval(() => console.log(++i), 50) @@ -583,9 +553,7 @@ vi.advanceTimersByTime(150) This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. This will include asynchronously set timers. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts let i = 0 setInterval(() => Promise.resolve().then(() => console.log(++i)), 50) @@ -602,9 +570,7 @@ await vi.advanceTimersByTimeAsync(150) Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts let i = 0 setInterval(() => console.log(++i), 50) @@ -619,9 +585,7 @@ vi.advanceTimersToNextTimer() // log: 1 Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call. -```ts twoslash -import { expect, vi } from 'vitest' -// ---cut--- +```ts let i = 0 setInterval(() => Promise.resolve().then(() => console.log(++i)), 50) @@ -666,9 +630,7 @@ Calls every microtask that was queued by `process.nextTick`. This will also run This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired. If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](/config/#faketimers-looplimit)). -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts let i = 0 setTimeout(() => console.log(++i)) const interval = setInterval(() => { @@ -692,9 +654,7 @@ vi.runAllTimers() This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers. If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](/config/#faketimers-looplimit)). -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts setTimeout(async () => { console.log(await Promise.resolve('result')) }, 100) @@ -710,9 +670,7 @@ await vi.runAllTimersAsync() This method will call every timer that was initiated after [`vi.useFakeTimers`](#vi-usefaketimers) call. It will not fire any timer that was initiated during its call. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts let i = 0 setInterval(() => console.log(++i), 50) @@ -727,9 +685,7 @@ vi.runOnlyPendingTimers() This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](#vi-usefaketimers) call, even asynchronous ones. It will not fire any timer that was initiated during its call. -```ts twoslash -import { vi } from 'vitest' -// ---cut--- +```ts setTimeout(() => { console.log(1) }, 100) @@ -758,9 +714,7 @@ If fake timers are enabled, this method simulates a user changing the system clo Useful if you need to test anything that depends on the current date - for example [Luxon](https://github.com/moment/luxon/) calls inside your code. -```ts twoslash -import { expect, vi } from 'vitest' -// ---cut--- +```ts const date = new Date(1998, 11, 19) vi.useFakeTimers() @@ -870,7 +824,7 @@ This is similar to `vi.waitFor`, but if the callback throws any errors, executio Look at the example below. We can use `vi.waitUntil` to wait for the element to appear on the page, and then we can do something with the element. -```ts twoslash +```ts import { expect, test, vi } from 'vitest' test('Element render correctly', async () => { diff --git a/docs/config/file.md b/docs/config/file.md index 7fdfc47a6..c92899ce0 100644 --- a/docs/config/file.md +++ b/docs/config/file.md @@ -14,7 +14,7 @@ To configure `vitest` itself, add `test` property in your Vite config. You'll al Using `defineConfig` from `vite` you should follow this: -```ts twoslash +```ts /// import { defineConfig } from 'vite' @@ -27,7 +27,7 @@ export default defineConfig({ Using `defineConfig` from `vitest/config` you should follow this: -```ts twoslash +```ts import { defineConfig } from 'vitest/config' export default defineConfig({ diff --git a/docs/config/index.md b/docs/config/index.md index 6f768ab4c..917c43150 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -571,6 +571,14 @@ Enable watch mode Project root +### dir + +- **Type:** `string` +- **CLI:** `--dir=` +- **Default:** same as `root` + +Base directory to scan for the test files. You can specify this option to speed up test discovery if your root covers the whole project + ### reporters - **Type:** `Reporter | Reporter[]` diff --git a/docs/guide/cli-generated.md b/docs/guide/cli-generated.md new file mode 100644 index 000000000..80e134381 --- /dev/null +++ b/docs/guide/cli-generated.md @@ -0,0 +1,828 @@ +### root + +- **CLI:** `-r, --root ` +- **Config:** [root](/config/#root) + +Root path + +### config + +- **CLI:** `-c, --config ` + +Path to config file + +### update + +- **CLI:** `-u, --update` +- **Config:** [update](/config/#update) + +Update snapshot + +### watch + +- **CLI:** `-w, --watch` +- **Config:** [watch](/config/#watch) + +Enable watch mode + +### testNamePattern + +- **CLI:** `-t, --testNamePattern ` +- **Config:** [testNamePattern](/config/#testnamepattern) + +Run tests with full names matching the specified regexp pattern + +### dir + +- **CLI:** `--dir ` +- **Config:** [dir](/config/#dir) + +Base directory to scan for the test files + +### ui + +- **CLI:** `--ui` +- **Config:** [ui](/config/#ui) + +Enable UI + +### open + +- **CLI:** `--open` +- **Config:** [open](/config/#open) + +Open UI automatically (default: `!process.env.CI`) + +### api.port + +- **CLI:** `--api.port [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 `51204` + +### api.host + +- **CLI:** `--api.host [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 + +### api.strictPort + +- **CLI:** `--api.strictPort` + +Set to true to exit if port is already in use, instead of automatically trying the next available port + +### silent + +- **CLI:** `--silent` +- **Config:** [silent](/config/#silent) + +Silent console output from tests + +### hideSkippedTests + +- **CLI:** `--hideSkippedTests` + +Hide logs for skipped tests + +### reporters + +- **CLI:** `--reporter ` +- **Config:** [reporters](/config/#reporters) + +Specify reporters + +### outputFile + +- **CLI:** `--outputFile ` +- **Config:** [outputFile](/config/#outputfile) + +Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: `--outputFile.tap=./tap.txt`) + +### coverage.all + +- **CLI:** `--coverage.all` +- **Config:** [coverage.all](/config/#coverage-all) + +Whether to include all files, including the untested ones into report + +### coverage.provider + +- **CLI:** `--coverage.provider ` +- **Config:** [coverage.provider](/config/#coverage-provider) + +Select the tool for coverage collection, available values are: "v8", "istanbul" and "custom" + +### coverage.enabled + +- **CLI:** `--coverage.enabled` +- **Config:** [coverage.enabled](/config/#coverage-enabled) + +Enables coverage collection. Can be overridden using the `--coverage` CLI option (default: `false`) + +### coverage.include + +- **CLI:** `--coverage.include ` +- **Config:** [coverage.include](/config/#coverage-include) + +Files included in coverage as glob patterns. May be specified more than once when using multiple patterns (default: `**`) + +### coverage.exclude + +- **CLI:** `--coverage.exclude ` +- **Config:** [coverage.exclude](/config/#coverage-exclude) + +Files to be excluded in coverage. May be specified more than once when using multiple extensions (default: Visit [`coverage.exclude`](https://vitest.dev/config/#coverage-exclude)) + +### coverage.extension + +- **CLI:** `--coverage.extension ` +- **Config:** [coverage.extension](/config/#coverage-extension) + +Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[".js", ".cjs", ".mjs", ".ts", ".mts", ".tsx", ".jsx", ".vue", ".svelte"]`) + +### coverage.clean + +- **CLI:** `--coverage.clean` +- **Config:** [coverage.clean](/config/#coverage-clean) + +Clean coverage results before running tests (default: true) + +### coverage.cleanOnRerun + +- **CLI:** `--coverage.cleanOnRerun` +- **Config:** [coverage.cleanOnRerun](/config/#coverage-cleanonrerun) + +Clean coverage report on watch rerun (default: true) + +### coverage.reportsDirectory + +- **CLI:** `--coverage.reportsDirectory ` +- **Config:** [coverage.reportsDirectory](/config/#coverage-reportsdirectory) + +Directory to write coverage report to (default: ./coverage) + +### coverage.reporter + +- **CLI:** `--coverage.reporter ` +- **Config:** [coverage.reporter](/config/#coverage-reporter) + +Coverage reporters to use. Visit [`coverage.reporter`](https://vitest.dev/config/#coverage-reporter) for more information (default: `["text", "html", "clover", "json"]`) + +### coverage.reportOnFailure + +- **CLI:** `--coverage.reportOnFailure` +- **Config:** [coverage.reportOnFailure](/config/#coverage-reportonfailure) + +Generate coverage report even when tests fail (default: `false`) + +### coverage.allowExternal + +- **CLI:** `--coverage.allowExternal` +- **Config:** [coverage.allowExternal](/config/#coverage-allowexternal) + +Collect coverage of files outside the project root (default: `false`) + +### coverage.skipFull + +- **CLI:** `--coverage.skipFull` +- **Config:** [coverage.skipFull](/config/#coverage-skipfull) + +Do not show files with 100% statement, branch, and function coverage (default: `false`) + +### coverage.thresholds.100 + +- **CLI:** `--coverage.thresholds.100` +- **Config:** [coverage.thresholds.100](/config/#coverage-thresholds-100) + +Shortcut to set all coverage thresholds to 100 (default: `false`) + +### coverage.thresholds.perFile + +- **CLI:** `--coverage.thresholds.perFile` +- **Config:** [coverage.thresholds.perFile](/config/#coverage-thresholds-perfile) + +Check thresholds per file. See `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches` and `--coverage.thresholds.statements` for the actual thresholds (default: `false`) + +### coverage.thresholds.autoUpdate + +- **CLI:** `--coverage.thresholds.autoUpdate` +- **Config:** [coverage.thresholds.autoUpdate](/config/#coverage-thresholds-autoupdate) + +Update threshold values: "lines", "functions", "branches" and "statements" to configuration file when current coverage is above the configured thresholds (default: `false`) + +### coverage.thresholds.lines + +- **CLI:** `--coverage.thresholds.lines ` + +Threshold for lines. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers + +### coverage.thresholds.functions + +- **CLI:** `--coverage.thresholds.functions ` + +Threshold for functions. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers + +### coverage.thresholds.branches + +- **CLI:** `--coverage.thresholds.branches ` + +Threshold for branches. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers + +### coverage.thresholds.statements + +- **CLI:** `--coverage.thresholds.statements ` + +Threshold for statements. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers + +### coverage.ignoreClassMethods + +- **CLI:** `--coverage.ignoreClassMethods ` +- **Config:** [coverage.ignoreClassMethods](/config/#coverage-ignoreclassmethods) + +Array of class method names to ignore for coverage. Visit [istanbuljs](https://github.com/istanbuljs/nyc#ignoring-methods) for more information. This option is only available for the istanbul providers (default: `[]`) + +### coverage.processingConcurrency + +- **CLI:** `--coverage.processingConcurrency ` +- **Config:** [coverage.processingConcurrency](/config/#coverage-processingconcurrency) + +Concurrency limit used when processing the coverage results. (default min between 20 and the number of CPUs) + +### coverage.customProviderModule + +- **CLI:** `--coverage.customProviderModule ` +- **Config:** [coverage.customProviderModule](/config/#coverage-customprovidermodule) + +Specifies the module name or path for the custom coverage provider module. Visit [Custom Coverage Provider](https://vitest.dev/guide/coverage#custom-coverage-provider) for more information. This option is only available for custom providers + +### coverage.watermarks.statements + +- **CLI:** `--coverage.watermarks.statements ` + +High and low watermarks for statements in the format of `,` + +### coverage.watermarks.lines + +- **CLI:** `--coverage.watermarks.lines ` + +High and low watermarks for lines in the format of `,` + +### coverage.watermarks.branches + +- **CLI:** `--coverage.watermarks.branches ` + +High and low watermarks for branches in the format of `,` + +### coverage.watermarks.functions + +- **CLI:** `--coverage.watermarks.functions ` + +High and low watermarks for functions in the format of `,` + +### mode + +- **CLI:** `--mode ` +- **Config:** [mode](/config/#mode) + +Override Vite mode (default: `test` or `benchmark`) + +### workspace + +- **CLI:** `--workspace ` +- **Config:** [workspace](/config/#workspace) + +Path to a workspace configuration file + +### isolate + +- **CLI:** `--isolate` +- **Config:** [isolate](/config/#isolate) + +Run every test file in isolation. To disable isolation, use `--no-isolate` (default: `true`) + +### globals + +- **CLI:** `--globals` +- **Config:** [globals](/config/#globals) + +Inject apis globally + +### dom + +- **CLI:** `--dom` + +Mock browser API with happy-dom + +### browser.enabled + +- **CLI:** `--browser.enabled` +- **Config:** [browser.enabled](/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) + +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 + +### browser.headless + +- **CLI:** `--browser.headless` +- **Config:** [browser.headless](/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) + +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) + +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) + +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) + +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) + +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) + +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) + +Show Vitest UI when running tests (default: `!process.env.CI`) + +### browser.fileParallelism + +- **CLI:** `--browser.fileParallelism` +- **Config:** [browser.fileParallelism](/config/#browser-fileparallelism) + +Should browser test files run in parallel. Use `--browser.fileParallelism=false` to disable (default: `true`) + +### pool + +- **CLI:** `--pool ` +- **Config:** [pool](/config/#pool) + +Specify pool, if not running in the browser (default: `threads`) + +### poolOptions.threads.isolate + +- **CLI:** `--poolOptions.threads.isolate` +- **Config:** [poolOptions.threads.isolate](/config/#pooloptions-threads-isolate) + +Isolate tests in threads pool (default: `true`) + +### poolOptions.threads.singleThread + +- **CLI:** `--poolOptions.threads.singleThread` +- **Config:** [poolOptions.threads.singleThread](/config/#pooloptions-threads-singlethread) + +Run tests inside a single thread (default: `false`) + +### poolOptions.threads.maxThreads + +- **CLI:** `--poolOptions.threads.maxThreads ` +- **Config:** [poolOptions.threads.maxThreads](/config/#pooloptions-threads-maxthreads) + +Maximum number or percentage of threads to run tests in + +### poolOptions.threads.minThreads + +- **CLI:** `--poolOptions.threads.minThreads ` +- **Config:** [poolOptions.threads.minThreads](/config/#pooloptions-threads-minthreads) + +Minimum number or percentage of threads to run tests in + +### poolOptions.threads.useAtomics + +- **CLI:** `--poolOptions.threads.useAtomics` +- **Config:** [poolOptions.threads.useAtomics](/config/#pooloptions-threads-useatomics) + +Use Atomics to synchronize threads. This can improve performance in some cases, but might cause segfault in older Node versions (default: `false`) + +### poolOptions.vmThreads.isolate + +- **CLI:** `--poolOptions.vmThreads.isolate` +- **Config:** [poolOptions.vmThreads.isolate](/config/#pooloptions-vmthreads-isolate) + +Isolate tests in threads pool (default: `true`) + +### poolOptions.vmThreads.singleThread + +- **CLI:** `--poolOptions.vmThreads.singleThread` +- **Config:** [poolOptions.vmThreads.singleThread](/config/#pooloptions-vmthreads-singlethread) + +Run tests inside a single thread (default: `false`) + +### poolOptions.vmThreads.maxThreads + +- **CLI:** `--poolOptions.vmThreads.maxThreads ` +- **Config:** [poolOptions.vmThreads.maxThreads](/config/#pooloptions-vmthreads-maxthreads) + +Maximum number or percentage of threads to run tests in + +### poolOptions.vmThreads.minThreads + +- **CLI:** `--poolOptions.vmThreads.minThreads ` +- **Config:** [poolOptions.vmThreads.minThreads](/config/#pooloptions-vmthreads-minthreads) + +Minimum number or percentage of threads to run tests in + +### poolOptions.vmThreads.useAtomics + +- **CLI:** `--poolOptions.vmThreads.useAtomics` +- **Config:** [poolOptions.vmThreads.useAtomics](/config/#pooloptions-vmthreads-useatomics) + +Use Atomics to synchronize threads. This can improve performance in some cases, but might cause segfault in older Node versions (default: `false`) + +### poolOptions.vmThreads.memoryLimit + +- **CLI:** `--poolOptions.vmThreads.memoryLimit ` +- **Config:** [poolOptions.vmThreads.memoryLimit](/config/#pooloptions-vmthreads-memorylimit) + +Memory limit for VM threads pool. If you see memory leaks, try to tinker this value. + +### poolOptions.forks.isolate + +- **CLI:** `--poolOptions.forks.isolate` +- **Config:** [poolOptions.forks.isolate](/config/#pooloptions-forks-isolate) + +Isolate tests in forks pool (default: `true`) + +### poolOptions.forks.singleFork + +- **CLI:** `--poolOptions.forks.singleFork` +- **Config:** [poolOptions.forks.singleFork](/config/#pooloptions-forks-singlefork) + +Run tests inside a single child_process (default: `false`) + +### poolOptions.forks.maxForks + +- **CLI:** `--poolOptions.forks.maxForks ` +- **Config:** [poolOptions.forks.maxForks](/config/#pooloptions-forks-maxforks) + +Maximum number or percentage of processes to run tests in + +### poolOptions.forks.minForks + +- **CLI:** `--poolOptions.forks.minForks ` +- **Config:** [poolOptions.forks.minForks](/config/#pooloptions-forks-minforks) + +Minimum number or percentage of processes to run tests in + +### poolOptions.vmForks.isolate + +- **CLI:** `--poolOptions.vmForks.isolate` +- **Config:** [poolOptions.vmForks.isolate](/config/#pooloptions-vmforks-isolate) + +Isolate tests in forks pool (default: `true`) + +### poolOptions.vmForks.singleFork + +- **CLI:** `--poolOptions.vmForks.singleFork` +- **Config:** [poolOptions.vmForks.singleFork](/config/#pooloptions-vmforks-singlefork) + +Run tests inside a single child_process (default: `false`) + +### poolOptions.vmForks.maxForks + +- **CLI:** `--poolOptions.vmForks.maxForks ` +- **Config:** [poolOptions.vmForks.maxForks](/config/#pooloptions-vmforks-maxforks) + +Maximum number or percentage of processes to run tests in + +### poolOptions.vmForks.minForks + +- **CLI:** `--poolOptions.vmForks.minForks ` +- **Config:** [poolOptions.vmForks.minForks](/config/#pooloptions-vmforks-minforks) + +Minimum number or percentage of processes to run tests in + +### poolOptions.vmForks.memoryLimit + +- **CLI:** `--poolOptions.vmForks.memoryLimit ` +- **Config:** [poolOptions.vmForks.memoryLimit](/config/#pooloptions-vmforks-memorylimit) + +Memory limit for VM forks pool. If you see memory leaks, try to tinker this value. + +### fileParallelism + +- **CLI:** `--fileParallelism` +- **Config:** [fileParallelism](/config/#fileparallelism) + +Should all test files run in parallel. Use `--no-file-parallelism` to disable (default: `true`) + +### maxWorkers + +- **CLI:** `--maxWorkers ` +- **Config:** [maxWorkers](/config/#maxworkers) + +Maximum number or percentage of workers to run tests in + +### minWorkers + +- **CLI:** `--minWorkers ` +- **Config:** [minWorkers](/config/#minworkers) + +Minimum number or percentage of workers to run tests in + +### environment + +- **CLI:** `--environment ` +- **Config:** [environment](/config/#environment) + +Specify runner environment, if not running in the browser (default: `node`) + +### passWithNoTests + +- **CLI:** `--passWithNoTests` +- **Config:** [passWithNoTests](/config/#passwithnotests) + +Pass when no tests are found + +### logHeapUsage + +- **CLI:** `--logHeapUsage` +- **Config:** [logHeapUsage](/config/#logheapusage) + +Show the size of heap for each test when running in node + +### allowOnly + +- **CLI:** `--allowOnly` +- **Config:** [allowOnly](/config/#allowonly) + +Allow tests and suites that are marked as only (default: `!process.env.CI`) + +### dangerouslyIgnoreUnhandledErrors + +- **CLI:** `--dangerouslyIgnoreUnhandledErrors` +- **Config:** [dangerouslyIgnoreUnhandledErrors](/config/#dangerouslyignoreunhandlederrors) + +Ignore any unhandled errors that occur + +### sequence.shuffle.files + +- **CLI:** `--sequence.shuffle.files` +- **Config:** [sequence.shuffle.files](/config/#sequence-shuffle-files) + +Run files in a random order. Long running tests will not start earlier if you enable this option. (default: `false`) + +### sequence.shuffle.tests + +- **CLI:** `--sequence.shuffle.tests` +- **Config:** [sequence.shuffle.tests](/config/#sequence-shuffle-tests) + +Run tests in a random order (default: `false`) + +### sequence.concurrent + +- **CLI:** `--sequence.concurrent` +- **Config:** [sequence.concurrent](/config/#sequence-concurrent) + +Make tests run in parallel (default: `false`) + +### sequence.seed + +- **CLI:** `--sequence.seed ` +- **Config:** [sequence.seed](/config/#sequence-seed) + +Set the randomization seed. This option will have no effect if `--sequence.shuffle` is falsy. Visit ["Random Seed" page](https://en.wikipedia.org/wiki/Random_seed) for more information + +### sequence.hooks + +- **CLI:** `--sequence.hooks ` +- **Config:** [sequence.hooks](/config/#sequence-hooks) + +Changes the order in which hooks are executed. Accepted values are: "stack", "list" and "parallel". Visit [`sequence.hooks`](https://vitest.dev/config/#sequence-hooks) for more information (default: `"parallel"`) + +### sequence.setupFiles + +- **CLI:** `--sequence.setupFiles ` +- **Config:** [sequence.setupFiles](/config/#sequence-setupfiles) + +Changes the order in which setup files are executed. Accepted values are: "list" and "parallel". If set to "list", will run setup files in the order they are defined. If set to "parallel", will run setup files in parallel (default: `"parallel"`) + +### inspect + +- **CLI:** `--inspect [[host:]port]` +- **Config:** [inspect](/config/#inspect) + +Enable Node.js inspector (default: `127.0.0.1:9229`) + +### inspectBrk + +- **CLI:** `--inspectBrk [[host:]port]` +- **Config:** [inspectBrk](/config/#inspectbrk) + +Enable Node.js inspector and break before the test starts + +### testTimeout + +- **CLI:** `--testTimeout ` +- **Config:** [testTimeout](/config/#testtimeout) + +Default timeout of a test in milliseconds (default: `5000`) + +### hookTimeout + +- **CLI:** `--hookTimeout ` +- **Config:** [hookTimeout](/config/#hooktimeout) + +Default hook timeout in milliseconds (default: `10000`) + +### bail + +- **CLI:** `--bail ` +- **Config:** [bail](/config/#bail) + +Stop test execution when given number of tests have failed (default: `0`) + +### retry + +- **CLI:** `--retry ` +- **Config:** [retry](/config/#retry) + +Retry the test specific number of times if it fails (default: `0`) + +### diff + +- **CLI:** `--diff ` +- **Config:** [diff](/config/#diff) + +Path to a diff config that will be used to generate diff interface + +### exclude + +- **CLI:** `--exclude ` +- **Config:** [exclude](/config/#exclude) + +Additional file globs to be excluded from test + +### expandSnapshotDiff + +- **CLI:** `--expandSnapshotDiff` +- **Config:** [expandSnapshotDiff](/config/#expandsnapshotdiff) + +Show full diff when snapshot fails + +### disableConsoleIntercept + +- **CLI:** `--disableConsoleIntercept` +- **Config:** [disableConsoleIntercept](/config/#disableconsoleintercept) + +Disable automatic interception of console logging (default: `false`) + +### typecheck.enabled + +- **CLI:** `--typecheck.enabled` +- **Config:** [typecheck.enabled](/config/#typecheck-enabled) + +Enable typechecking alongside tests (default: `false`) + +### typecheck.only + +- **CLI:** `--typecheck.only` +- **Config:** [typecheck.only](/config/#typecheck-only) + +Run only typecheck tests. This automatically enables typecheck (default: `false`) + +### typecheck.checker + +- **CLI:** `--typecheck.checker ` +- **Config:** [typecheck.checker](/config/#typecheck-checker) + +Specify the typechecker to use. Available values are: "tsc" and "vue-tsc" and a path to an executable (default: `"tsc"`) + +### typecheck.allowJs + +- **CLI:** `--typecheck.allowJs` +- **Config:** [typecheck.allowJs](/config/#typecheck-allowjs) + +Allow JavaScript files to be typechecked. By default takes the value from tsconfig.json + +### typecheck.ignoreSourceErrors + +- **CLI:** `--typecheck.ignoreSourceErrors` +- **Config:** [typecheck.ignoreSourceErrors](/config/#typecheck-ignoresourceerrors) + +Ignore type errors from source files + +### typecheck.tsconfig + +- **CLI:** `--typecheck.tsconfig ` +- **Config:** [typecheck.tsconfig](/config/#typecheck-tsconfig) + +Path to a custom tsconfig file + +### project + +- **CLI:** `--project ` +- **Config:** [project](/config/#project) + +The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*` + +### slowTestThreshold + +- **CLI:** `--slowTestThreshold ` +- **Config:** [slowTestThreshold](/config/#slowtestthreshold) + +Threshold in milliseconds for a test to be considered slow (default: `300`) + +### teardownTimeout + +- **CLI:** `--teardownTimeout ` +- **Config:** [teardownTimeout](/config/#teardowntimeout) + +Default timeout of a teardown function in milliseconds (default: `10000`) + +### maxConcurrency + +- **CLI:** `--maxConcurrency ` +- **Config:** [maxConcurrency](/config/#maxconcurrency) + +Maximum number of concurrent tests in a suite (default: `5`) + +### expect.requireAssertions + +- **CLI:** `--expect.requireAssertions` +- **Config:** [expect.requireAssertions](/config/#expect-requireassertions) + +Require that all tests have at least one assertion + +### expect.poll.interval + +- **CLI:** `--expect.poll.interval ` +- **Config:** [expect.poll.interval](/config/#expect-poll-interval) + +Poll interval in milliseconds for `expect.poll()` assertions (default: `50`) + +### expect.poll.timeout + +- **CLI:** `--expect.poll.timeout ` +- **Config:** [expect.poll.timeout](/config/#expect-poll-timeout) + +Poll timeout in milliseconds for `expect.poll()` assertions (default: `1000`) + +### printConsoleTrace + +- **CLI:** `--printConsoleTrace` +- **Config:** [printConsoleTrace](/config/#printconsoletrace) + +Always print console stack traces + +### run + +- **CLI:** `--run` + +Disable watch mode + +### color + +- **CLI:** `--no-color` + +Removes colors from the console output + +### clearScreen + +- **CLI:** `--clearScreen` + +Clear terminal screen when re-running tests during watch mode (default: `true`) + +### standalone + +- **CLI:** `--standalone` + +Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`) diff --git a/docs/guide/cli-table.md b/docs/guide/cli-table.md deleted file mode 100644 index 1ffef7e1f..000000000 --- a/docs/guide/cli-table.md +++ /dev/null @@ -1,126 +0,0 @@ -| Options | | -| ------------- | ------------- | -| `-r, --root ` | Root path | -| `-c, --config ` | Path to config file | -| `-u, --update` | Update snapshot | -| `-w, --watch` | Enable watch mode | -| `-t, --testNamePattern ` | Run tests with full names matching the specified regexp pattern | -| `--dir ` | Base directory to scan for the test files | -| `--ui` | Enable UI | -| `--open` | Open UI automatically (default: `!process.env.CI`) | -| `--api.port [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 `51204` | -| `--api.host [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 | -| `--api.strictPort` | Set to true to exit if port is already in use, instead of automatically trying the next available port | -| `--silent` | Silent console output from tests | -| `--hideSkippedTests` | Hide logs for skipped tests | -| `--reporter ` | Specify reporters | -| `--outputFile ` | Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt) | -| `--coverage.all` | Whether to include all files, including the untested ones into report | -| `--coverage.provider ` | Select the tool for coverage collection, available values are: "v8", "istanbul" and "custom" | -| `--coverage.enabled` | Enables coverage collection. Can be overridden using the `--coverage` CLI option (default: `false`) | -| `--coverage.include ` | Files included in coverage as glob patterns. May be specified more than once when using multiple patterns (default: `**`) | -| `--coverage.exclude ` | Files to be excluded in coverage. May be specified more than once when using multiple extensions (default: Visit [`coverage.exclude`](https://vitest.dev/config/#coverage-exclude)) | -| `--coverage.extension ` | Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[".js", ".cjs", ".mjs", ".ts", ".mts", ".tsx", ".jsx", ".vue", ".svelte"]`) | -| `--coverage.clean` | Clean coverage results before running tests (default: true) | -| `--coverage.cleanOnRerun` | Clean coverage report on watch rerun (default: true) | -| `--coverage.reportsDirectory ` | Directory to write coverage report to (default: ./coverage) | -| `--coverage.reporter ` | Coverage reporters to use. Visit [`coverage.reporter`](https://vitest.dev/config/#coverage-reporter) for more information (default: `["text", "html", "clover", "json"]`) | -| `--coverage.reportOnFailure` | Generate coverage report even when tests fail (default: `false`) | -| `--coverage.allowExternal` | Collect coverage of files outside the project root (default: `false`) | -| `--coverage.skipFull` | Do not show files with 100% statement, branch, and function coverage (default: `false`) | -| `--coverage.thresholds.100` | Shortcut to set all coverage thresholds to 100 (default: `false`) | -| `--coverage.thresholds.perFile` | Check thresholds per file. See `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches` and `--coverage.thresholds.statements` for the actual thresholds (default: `false`) | -| `--coverage.thresholds.autoUpdate` | Update threshold values: "lines", "functions", "branches" and "statements" to configuration file when current coverage is above the configured thresholds (default: `false`) | -| `--coverage.thresholds.lines ` | Threshold for lines. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers | -| `--coverage.thresholds.functions ` | Threshold for functions. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers | -| `--coverage.thresholds.branches ` | Threshold for branches. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers | -| `--coverage.thresholds.statements ` | Threshold for statements. Visit [istanbuljs](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. This option is not available for custom providers | -| `--coverage.ignoreClassMethods ` | Array of class method names to ignore for coverage. Visit [istanbuljs](https://github.com/istanbuljs/nyc#ignoring-methods) for more information. This option is only available for the istanbul providers (default: `[]`) | -| `--coverage.processingConcurrency ` | Concurrency limit used when processing the coverage results. (default min between 20 and the number of CPUs) | -| `--coverage.customProviderModule ` | Specifies the module name or path for the custom coverage provider module. Visit [Custom Coverage Provider](https://vitest.dev/guide/coverage#custom-coverage-provider) for more information. This option is only available for custom providers | -| `--coverage.watermarks.statements ` | High and low watermarks for statements in the format of `,` | -| `--coverage.watermarks.lines ` | High and low watermarks for lines in the format of `,` | -| `--coverage.watermarks.branches ` | High and low watermarks for branches in the format of `,` | -| `--coverage.watermarks.functions ` | High and low watermarks for functions in the format of `,` | -| `--mode ` | Override Vite mode (default: `test` or `benchmark`) | -| `--workspace ` | Path to a workspace configuration file | -| `--isolate` | Run every test file in isolation. To disable isolation, use `--no-isolate` (default: `true`) | -| `--globals` | Inject apis globally | -| `--dom` | Mock browser API with happy-dom | -| `--browser.enabled` | Run tests in the browser. Equivalent to `--browser.enabled` (default: `false`) | -| `--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 | -| `--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 [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 [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` | Set to true to exit if port is already in use, instead of automatically trying the next available port | -| `--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 ` | Options that are passed down to a browser provider. Visit [`browser.providerOptions`](https://vitest.dev/config/#browser-provideroptions) for more information | -| `--browser.isolate` | Run every browser test file in isolation. To disable isolation, use `--browser.isolate=false` (default: `true`) | -| `--browser.ui` | Show Vitest UI when running tests (default: `!process.env.CI`) | -| `--browser.fileParallelism` | Should browser test files run in parallel. Use `--browser.fileParallelism=false` to disable (default: `true`) | -| `--pool ` | Specify pool, if not running in the browser (default: `threads`) | -| `--poolOptions.threads.isolate` | Isolate tests in threads pool (default: `true`) | -| `--poolOptions.threads.singleThread` | Run tests inside a single thread (default: `false`) | -| `--poolOptions.threads.maxThreads ` | Maximum number or percentage of threads to run tests in | -| `--poolOptions.threads.minThreads ` | Minimum number or percentage of threads to run tests in | -| `--poolOptions.threads.useAtomics` | Use Atomics to synchronize threads. This can improve performance in some cases, but might cause segfault in older Node versions (default: `false`) | -| `--poolOptions.vmThreads.isolate` | Isolate tests in threads pool (default: `true`) | -| `--poolOptions.vmThreads.singleThread` | Run tests inside a single thread (default: `false`) | -| `--poolOptions.vmThreads.maxThreads ` | Maximum number or percentage of threads to run tests in | -| `--poolOptions.vmThreads.minThreads ` | Minimum number or percentage of threads to run tests in | -| `--poolOptions.vmThreads.useAtomics` | Use Atomics to synchronize threads. This can improve performance in some cases, but might cause segfault in older Node versions (default: `false`) | -| `--poolOptions.vmThreads.memoryLimit ` | Memory limit for VM threads pool. If you see memory leaks, try to tinker this value. | -| `--poolOptions.forks.isolate` | Isolate tests in forks pool (default: `true`) | -| `--poolOptions.forks.singleFork` | Run tests inside a single child_process (default: `false`) | -| `--poolOptions.forks.maxForks ` | Maximum number or percentage of processes to run tests in | -| `--poolOptions.forks.minForks ` | Minimum number or percentage of processes to run tests in | -| `--poolOptions.vmForks.isolate` | Isolate tests in forks pool (default: `true`) | -| `--poolOptions.vmForks.singleFork` | Run tests inside a single child_process (default: `false`) | -| `--poolOptions.vmForks.maxForks ` | Maximum number or percentage of processes to run tests in | -| `--poolOptions.vmForks.minForks ` | Minimum number or percentage of processes to run tests in | -| `--poolOptions.vmForks.memoryLimit ` | Memory limit for VM forks pool. If you see memory leaks, try to tinker this value. | -| `--fileParallelism` | Should all test files run in parallel. Use `--no-file-parallelism` to disable (default: `true`) | -| `--maxWorkers ` | Maximum number or percentage of workers to run tests in | -| `--minWorkers ` | Minimum number or percentage of workers to run tests in | -| `--environment ` | Specify runner environment, if not running in the browser (default: `node`) | -| `--passWithNoTests` | Pass when no tests are found | -| `--logHeapUsage` | Show the size of heap for each test when running in node | -| `--allowOnly` | Allow tests and suites that are marked as only (default: `!process.env.CI`) | -| `--dangerouslyIgnoreUnhandledErrors` | Ignore any unhandled errors that occur | -| `--shard ` | Test suite shard to execute in a format of `/` | -| `--changed [since]` | Run tests that are affected by the changed files (default: `false`) | -| `--sequence.shuffle.files` | Run files in a random order. Long running tests will not start earlier if you enable this option. (default: `false`) | -| `--sequence.shuffle.tests` | Run tests in a random order (default: `false`) | -| `--sequence.concurrent` | Make tests run in parallel (default: `false`) | -| `--sequence.seed ` | Set the randomization seed. This option will have no effect if --sequence.shuffle is falsy. Visit ["Random Seed" page](https://en.wikipedia.org/wiki/Random_seed) for more information | -| `--sequence.hooks ` | Changes the order in which hooks are executed. Accepted values are: "stack", "list" and "parallel". Visit [`sequence.hooks`](https://vitest.dev/config/#sequence-hooks) for more information (default: `"parallel"`) | -| `--sequence.setupFiles ` | Changes the order in which setup files are executed. Accepted values are: "list" and "parallel". If set to "list", will run setup files in the order they are defined. If set to "parallel", will run setup files in parallel (default: `"parallel"`) | -| `--inspect [[host:]port]` | Enable Node.js inspector (default: `127.0.0.1:9229`) | -| `--inspectBrk [[host:]port]` | Enable Node.js inspector and break before the test starts | -| `--testTimeout ` | Default timeout of a test in milliseconds (default: `5000`) | -| `--hookTimeout ` | Default hook timeout in milliseconds (default: `10000`) | -| `--bail ` | Stop test execution when given number of tests have failed (default: `0`) | -| `--retry ` | Retry the test specific number of times if it fails (default: `0`) | -| `--diff ` | Path to a diff config that will be used to generate diff interface | -| `--exclude ` | Additional file globs to be excluded from test | -| `--expandSnapshotDiff` | Show full diff when snapshot fails | -| `--disableConsoleIntercept` | Disable automatic interception of console logging (default: `false`) | -| `--typecheck.enabled` | Enable typechecking alongside tests (default: `false`) | -| `--typecheck.only` | Run only typecheck tests. This automatically enables typecheck (default: `false`) | -| `--typecheck.checker ` | Specify the typechecker to use. Available values are: "tsc" and "vue-tsc" and a path to an executable (default: `"tsc"`) | -| `--typecheck.allowJs` | Allow JavaScript files to be typechecked. By default takes the value from tsconfig.json | -| `--typecheck.ignoreSourceErrors` | Ignore type errors from source files | -| `--typecheck.tsconfig ` | Path to a custom tsconfig file | -| `--project ` | The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*` | -| `--slowTestThreshold ` | Threshold in milliseconds for a test to be considered slow (default: `300`) | -| `--teardownTimeout ` | Default timeout of a teardown function in milliseconds (default: `10000`) | -| `--maxConcurrency ` | Maximum number of concurrent tests in a suite (default: `5`) | -| `--expect.requireAssertions` | Require that all tests have at least one assertion | -| `--expect.poll.interval ` | Poll interval in milliseconds for `expect.poll()` assertions (default: `50`) | -| `--expect.poll.timeout ` | Poll timeout in milliseconds for `expect.poll()` assertions (default: `1000`) | -| `--printConsoleTrace` | Always print console stack traces | -| `--run` | Disable watch mode | -| `--no-color` | Removes colors from the console output | -| `--clearScreen` | Clear terminal screen when re-running tests during watch mode (default: `true`) | -| `--standalone` | Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`) | -| `--mergeReports [path]` | Paths to blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests | diff --git a/docs/guide/cli.md b/docs/guide/cli.md index 8b636ca27..9041fc80e 100644 --- a/docs/guide/cli.md +++ b/docs/guide/cli.md @@ -1,5 +1,6 @@ --- title: Command Line Interface | Guide +outline: deep --- # Command Line Interface @@ -87,8 +88,6 @@ If `--json` flag doesn't receive a value, it will output the JSON into stdout. ## Options - - ::: tip Vitest supports both camel case and kebab case for CLI arguments. For example, `--passWithNoTests` and `--pass-with-no-tests` will both work (`--no-color` and `--inspect-brk` are the exceptions). @@ -108,36 +107,38 @@ vitest --api=false ``` ::: + + ### changed - **Type**: `boolean | string` - **Default**: false - Run tests only against changed files. If no value is provided, it will run tests against uncommitted changes (including staged and unstaged). +Run tests only against changed files. If no value is provided, it will run tests against uncommitted changes (including staged and unstaged). - To run tests against changes made in the last commit, you can use `--changed HEAD~1`. You can also pass commit hash (e.g. `--changed 09a9920`) or branch name (e.g. `--changed origin/develop`). +To run tests against changes made in the last commit, you can use `--changed HEAD~1`. You can also pass commit hash (e.g. `--changed 09a9920`) or branch name (e.g. `--changed origin/develop`). - When used with code coverage the report will contain only the files that were related to the changes. +When used with code coverage the report will contain only the files that were related to the changes. - If paired with the [`forceRerunTriggers`](/config/#forcereruntriggers) config option it will run the whole test suite if at least one of the files listed in the `forceRerunTriggers` list changes. By default, changes to the Vitest config file and `package.json` will always rerun the whole suite. +If paired with the [`forceRerunTriggers`](/config/#forcereruntriggers) config option it will run the whole test suite if at least one of the files listed in the `forceRerunTriggers` list changes. By default, changes to the Vitest config file and `package.json` will always rerun the whole suite. ### shard - **Type**: `string` - **Default**: disabled - Test suite shard to execute in a format of ``/``, where +Test suite shard to execute in a format of ``/``, where - - `count` is a positive integer, count of divided parts - - `index` is a positive integer, index of divided part +- `count` is a positive integer, count of divided parts +- `index` is a positive integer, index of divided part - This command will divide all tests into `count` equal parts, and will run only those that happen to be in an `index` part. For example, to split your tests suite into three parts, use this: +This command will divide all tests into `count` equal parts, and will run only those that happen to be in an `index` part. For example, to split your tests suite into three parts, use this: - ```sh - vitest run --shard=1/3 - vitest run --shard=2/3 - vitest run --shard=3/3 - ``` +```sh +vitest run --shard=1/3 +vitest run --shard=2/3 +vitest run --shard=3/3 +``` :::warning You cannot use this option with `--watch` enabled (enabled in dev by default). diff --git a/docs/guide/coverage.md b/docs/guide/coverage.md index b62628b94..c1072a9d4 100644 --- a/docs/guide/coverage.md +++ b/docs/guide/coverage.md @@ -12,7 +12,7 @@ Both `v8` and `istanbul` support are optional. By default, `v8` will be used. You can select the coverage tool by setting `test.coverage.provider` to `v8` or `istanbul`: -```ts twoslash +```ts // vitest.config.ts import { defineConfig } from 'vitest/config' @@ -58,7 +58,7 @@ By default, reporter `['text', 'html', 'clover', 'json']` will be used. To configure it, set `test.coverage` options in your config file: -```ts twoslash +```ts // vitest.config.ts import { defineConfig } from 'vitest/config' @@ -95,7 +95,7 @@ export default defineConfig({ Custom reporters are loaded by Istanbul and must match its reporter interface. See [built-in reporters' implementation](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-reports/lib) for reference. -```js twoslash +```js // custom-reporter.cjs const { ReportBase } = require('istanbul-lib-report') @@ -123,7 +123,7 @@ module.exports = class CustomReporter extends ReportBase { It's also possible to provide your custom coverage provider by passing `'custom'` in `test.coverage.provider`: -```ts twoslash +```ts // vitest.config.ts import { defineConfig } from 'vitest/config' @@ -141,7 +141,12 @@ The custom providers require a `customProviderModule` option which is a module n ```ts // my-custom-coverage-provider.ts -import type { CoverageProvider, CoverageProviderModule, ResolvedCoverageOptions, Vitest } from 'vitest' +import type { + CoverageProvider, + CoverageProviderModule, + ResolvedCoverageOptions, + Vitest +} from 'vitest' const CustomCoverageProviderModule: CoverageProviderModule = { getProvider(): CoverageProvider { @@ -171,7 +176,7 @@ Please refer to the type definition for more details. When running a coverage report, a `coverage` folder is created in the root directory of your project. If you want to move it to a different directory, use the `test.coverage.reportsDirectory` property in the `vite.config.js` file. -```js twoslash +```js import { defineConfig } from 'vite' export default defineConfig({ diff --git a/docs/guide/environment.md b/docs/guide/environment.md index 88816518a..4da5f0ea4 100644 --- a/docs/guide/environment.md +++ b/docs/guide/environment.md @@ -23,7 +23,7 @@ Since Vitest 2.0.4 the `require` of CSS and assets inside the external dependenc When setting `environment` option in your config, it will apply to all the test files in your project. To have more fine-grained control, you can use control comments to specify environment for specific files. Control comments are comments that start with `@vitest-environment` and are followed by the environment name: -```ts twoslash +```ts // @vitest-environment jsdom import { expect, test } from 'vitest' @@ -39,7 +39,7 @@ Or you can also set [`environmentMatchGlobs`](https://vitest.dev/config/#environ You can create your own package to extend Vitest environment. To do so, create package with the name `vitest-environment-${name}` or specify a path to a valid JS/TS file. That package should export an object with the shape of `Environment`: -```ts twoslash +```ts import type { Environment } from 'vitest' export default { @@ -75,7 +75,7 @@ Vitest requires `transformMode` option on environment object. It should be equal You also have access to default Vitest environments through `vitest/environments` entry: -```ts twoslash +```ts import { builtinEnvironments, populateGlobal } from 'vitest/environments' console.log(builtinEnvironments) // { jsdom, happy-dom, node, edge-runtime } diff --git a/docs/guide/features.md b/docs/guide/features.md index 5ea007d88..b02be0e4d 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -34,7 +34,7 @@ Out-of-the-box ES Module / TypeScript / JSX support / PostCSS ## Threads -By default Vitest runs test files in multiple threads using [`node:worker_threads`](https://nodejs.org/api/worker_threads.html) via [Tinypool](https://github.com/tinylibs/tinypool) (a lightweight fork of [Piscina](https://github.com/piscinajs/piscina)), allowing tests to run simultaneously. If your tests are running code that is not compatible with multi-threading, you can switch to [`--pool=forks`](/config/#pool) which runs tests in multiple processes using [`node:child_process`](https://nodejs.org/api/child_process.html) via Tinypool. +By default Vitest runs test files in multiple processes using [`node:child_process`](https://nodejs.org/api/child_process.html) via [Tinypool](https://github.com/tinylibs/tinypool) (a lightweight fork of [Piscina](https://github.com/piscinajs/piscina)), allowing tests to run simultaneously. If you want to speed up your test suite even further, consider enabling `--pool=threads` to run tests using [`node:worker_threads`](https://nodejs.org/api/worker_threads.html) (beware that some packages might not work with this setup). To run tests in a single thread or process, see [`poolOptions`](/config/#pooloptions). @@ -48,12 +48,12 @@ Learn more about [Test Filtering](/guide/filtering). ## Running Tests Concurrently -Use `.concurrent` in consecutive tests to run them in parallel. +Use `.concurrent` in consecutive tests to start them in parallel. -```ts twoslash +```ts import { describe, it } from 'vitest' -// The two tests marked with concurrent will be run in parallel +// The two tests marked with concurrent will be started in parallel describe('suite', () => { it('serial test', async () => { /* ... */ }) it.concurrent('concurrent test 1', async ({ expect }) => { /* ... */ }) @@ -61,12 +61,12 @@ describe('suite', () => { }) ``` -If you use `.concurrent` on a suite, every test in it will be run in parallel. +If you use `.concurrent` on a suite, every test in it will be started in parallel. -```ts twoslash +```ts import { describe, it } from 'vitest' -// All tests within this suite will be run in parallel +// All tests within this suite will be started in parallel describe.concurrent('suite', () => { it('concurrent test 1', async ({ expect }) => { /* ... */ }) it('concurrent test 2', async ({ expect }) => { /* ... */ }) @@ -97,15 +97,15 @@ Learn more at [Snapshot](/guide/snapshot). ## Chai and Jest `expect` Compatibility -[Chai](https://www.chaijs.com/) is built-in for assertions plus [Jest `expect`](https://jestjs.io/docs/expect)-compatible APIs. +[Chai](https://www.chaijs.com/) is built-in for assertions with [Jest `expect`](https://jestjs.io/docs/expect)-compatible APIs. -Notice that if you are using third-party libraries that add matchers, setting `test.globals` to `true` will provide better compatibility. +Notice that if you are using third-party libraries that add matchers, setting [`test.globals`](/config/#globals) to `true` will provide better compatibility. ## Mocking [Tinyspy](https://github.com/tinylibs/tinyspy) is built-in for mocking with `jest`-compatible APIs on `vi` object. -```ts twoslash +```ts import { expect, vi } from 'vitest' const fn = vi.fn() @@ -122,7 +122,7 @@ fn('world', 2) expect(fn.mock.results[1].value).toBe('world') ``` -Vitest supports both [happy-dom](https://github.com/capricorn86/happy-dom) or [jsdom](https://github.com/jsdom/jsdom) for mocking DOM and browser APIs. They don't come with Vitest, you might need to install them: +Vitest supports both [happy-dom](https://github.com/capricorn86/happy-dom) or [jsdom](https://github.com/jsdom/jsdom) for mocking DOM and browser APIs. They don't come with Vitest, you will need to install them separately: ```bash $ npm i -D happy-dom @@ -132,7 +132,7 @@ $ npm i -D jsdom After that, change the `environment` option in your config file: -```ts twoslash +```ts // vitest.config.ts import { defineConfig } from 'vitest/config' @@ -170,7 +170,7 @@ This makes the tests share the same closure as the implementations and able to t // src/index.ts // the implementation -export function add(...args: number[]) { +export function add(...args: number[]): number { return args.reduce((a, b) => a + b, 0) } @@ -191,7 +191,7 @@ Learn more at [In-source testing](/guide/in-source). You can run benchmark tests with [`bench`](/api/#bench) function via [Tinybench](https://github.com/tinylibs/tinybench) to compare performance results. -```ts twoslash +```ts import { bench, describe } from 'vitest' describe('sort', () => { @@ -219,7 +219,7 @@ describe('sort', () => { You can [write tests](/guide/testing-types) to catch type regressions. Vitest comes with [`expect-type`](https://github.com/mmkal/expect-type) package to provide you with a similar and easy to understand API. ```ts -import { assertType, expectTypeOf } from 'vitest' +import { assertType, expectTypeOf, test } from 'vitest' import { mount } from './mount.js' test('my types work properly', () => { @@ -248,7 +248,7 @@ See [`Improving Performance | Sharding`](/guide/improving-performance#sharding) Vitest exclusively autoloads environment variables prefixed with `VITE_` from `.env` files to maintain compatibility with frontend-related tests, adhering to [Vite's established convention](https://vitejs.dev/guide/env-and-mode.html#env-files). To load every environmental variable from `.env` files anyway, you can use `loadEnv` method imported from `vite`: -```ts twoslash +```ts import { loadEnv } from 'vite' import { defineConfig } from 'vitest/config' @@ -258,3 +258,4 @@ export default defineConfig(({ mode }) => ({ env: loadEnv(mode, process.cwd(), ''), }, })) +``` diff --git a/docs/guide/filtering.md b/docs/guide/filtering.md index bc11d553a..462d3cf95 100644 --- a/docs/guide/filtering.md +++ b/docs/guide/filtering.md @@ -28,7 +28,7 @@ You can also use the `-t, --testNamePattern ` option to filter tests by You can optionally pass a timeout in milliseconds as third argument to tests. The default is 5 seconds. -```ts twoslash +```ts import { test } from 'vitest' test('name', async () => { /* ... */ }, 1000) @@ -36,7 +36,7 @@ test('name', async () => { /* ... */ }, 1000) Hooks also can receive a timeout, with the same 5 seconds default. -```ts twoslash +```ts import { beforeAll } from 'vitest' beforeAll(async () => { /* ... */ }, 1000) @@ -46,7 +46,7 @@ beforeAll(async () => { /* ... */ }, 1000) Use `.skip` to avoid running certain suites or tests -```ts twoslash +```ts import { assert, describe, it } from 'vitest' describe.skip('skipped suite', () => { @@ -68,7 +68,7 @@ describe('suite', () => { Use `.only` to only run certain suites or tests -```ts twoslash +```ts import { assert, describe, it } from 'vitest' // Only this suite (and others marked with only) are run @@ -95,7 +95,7 @@ describe('another suite', () => { Use `.todo` to stub suites and tests that should be implemented -```ts twoslash +```ts import { describe, it } from 'vitest' // An entry will be shown in the report for this suite diff --git a/docs/guide/index.md b/docs/guide/index.md index db73d4011..e3a87fe60 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -34,7 +34,7 @@ bun add -D vitest ::: :::tip -Vitest 1.0 requires Vite >=v5.0.0 and Node >=v18.0.0 +Vitest requires Vite >=v5.0.0 and Node >=v18.0.0 ::: It is recommended that you install a copy of `vitest` in your `package.json`, using one of the methods listed above. However, if you would prefer to run `vitest` directly, you can use `npx vitest` (the `npx` tool comes with npm and Node.js). @@ -55,7 +55,7 @@ export function sum(a, b) { ``` js // sum.test.js import { expect, test } from 'vitest' -import { sum } from './sum' +import { sum } from './sum.js' test('adds 1 + 2 to equal 3', () => { expect(sum(1, 2)).toBe(3) @@ -76,18 +76,22 @@ Next, in order to execute the test, add the following section to your `package.j } ``` -Finally, run `npm run test`, `yarn test`, or `pnpm test`, depending on your package manager, and Vitest will print this message: +Finally, run `npm run test`, `yarn test` or `pnpm test`, depending on your package manager, and Vitest will print this message: ```txt ✓ sum.test.js (1) ✓ adds 1 + 2 to equal 3 Test Files 1 passed (1) - Tests 1 passed (1) + Tests 1 passed (1) Start at 02:15:44 Duration 311ms ``` +::: warning +If you are using Bun as your package manager, make sure to use `bun run test` command instead of `bun test`, otherwise Bun will run its own test runner. +::: + Learn more about the usage of Vitest, see the [API](https://vitest.dev/api/) section. ## Configuring Vitest @@ -102,7 +106,7 @@ Vitest supports the same extensions for your configuration file as Vite does: `. If you are not using Vite as your build tool, you can configure Vitest using the `test` property in your config file: -```ts twoslash +```ts import { defineConfig } from 'vitest/config' export default defineConfig({ @@ -142,7 +146,7 @@ import viteConfig from './vite.config.mjs' export default mergeConfig(viteConfig, defineConfig({ test: { // ... - } + }, })) ``` @@ -155,14 +159,14 @@ export default defineConfig({ }) ``` -But we recommend to use the same file for both Vite and Vitest instead of creating two separate files. +However, we recommend using the same file for both Vite and Vitest, instead of creating two separate files. ::: ## Workspaces Support Run different project configurations inside the same project with [Vitest Workspaces](/guide/workspace). You can define a list of files and folders that define your workspace in `vitest.workspace` file. The file supports `js`/`ts`/`json` extensions. This feature works great with monorepo setups. -```ts twoslash +```ts import { defineWorkspace } from 'vitest/config' export default defineWorkspace([ diff --git a/docs/guide/migration.md b/docs/guide/migration.md index 8083b68b1..b0d4055ee 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -335,7 +335,7 @@ server.deps.inline: ["lib-name"] Vitest's `test` names are joined with a `>` symbol to make it easier to distinguish tests from suites, while Jest uses an empty space (` `). -``` +```diff - `${describeTitle} ${testTitle}` + `${describeTitle} > ${testTitle}` ``` @@ -409,9 +409,8 @@ vi.setConfig({ testTimeout: 5_000 }) // [!code ++] This is not a Jest-specific feature, but if you previously were using Jest with vue-cli preset, you will need to install [`jest-serializer-vue`](https://github.com/eddyerburgh/jest-serializer-vue) package, and use it inside [setupFiles](/config/#setupfiles): -`vite.config.js` - -```js twoslash +:::code-group +```js [vite.config.js] import { defineConfig } from 'vite' export default defineConfig({ @@ -420,13 +419,11 @@ export default defineConfig({ } }) ``` - -`tests/unit/setup.js` - -```js +```js [tests/unit/setup.js] import vueSnapshotSerializer from 'jest-serializer-vue' expect.addSnapshotSerializer(vueSnapshotSerializer) ``` +::: Otherwise your snapshots will have a lot of escaped `"` characters. diff --git a/docs/guide/mocking.md b/docs/guide/mocking.md index 7fad80d2f..d9369618c 100644 --- a/docs/guide/mocking.md +++ b/docs/guide/mocking.md @@ -18,7 +18,7 @@ Sometimes you need to be in control of the date to ensure consistency when testi ### Example -```js twoslash +```js import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' const businessHours = [9, 17] @@ -77,7 +77,7 @@ We use [Tinyspy](https://github.com/tinylibs/tinyspy) as a base for mocking func ### Example -```js twoslash +```js import { afterEach, describe, expect, it, vi } from 'vitest' const messages = { @@ -138,7 +138,7 @@ describe('reading messages', () => { You can mock global variables that are not present with `jsdom` or `node` by using [`vi.stubGlobal`](/api/vi#vi-stubglobal) helper. It will put the value of the global variable into a `globalThis` object. -```ts twoslash +```ts import { vi } from 'vitest' const IntersectionObserverMock = vi.fn(() => ({ @@ -440,7 +440,7 @@ Mock Service Worker (MSW) works by intercepting the requests your tests make, al ### Configuration You can use it like below in your [setup file](/config/#setupfiles) -```js twoslash +```js import { afterAll, afterEach, beforeAll } from 'vitest' import { setupServer } from 'msw/node' import { HttpResponse, graphql, http } from 'msw' @@ -496,7 +496,7 @@ See the [`vi.useFakeTimers` API section](/api/vi#vi-usefaketimers) for a more in ### Example -```js twoslash +```js import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' function executeAfterTwoHours(func) { diff --git a/docs/guide/reporters.md b/docs/guide/reporters.md index 28399a03f..70907c03c 100644 --- a/docs/guide/reporters.md +++ b/docs/guide/reporters.md @@ -15,7 +15,7 @@ npx vitest --reporter=verbose Using reporters via [`vitest.config.ts`](/config/): -```ts twoslash +```ts /// import { defineConfig } from 'vite' @@ -81,10 +81,12 @@ When using multiple reporters, it's also possible to designate multiple output f ```ts export default defineConfig({ - reporters: ['junit', 'json', 'verbose'], - outputFile: { - junit: './junit-report.xml', - json: './json-report.json', + test: { + reporters: ['junit', 'json', 'verbose'], + outputFile: { + junit: './junit-report.xml', + json: './json-report.json', + }, }, }) ``` @@ -311,7 +313,8 @@ Example of a JSON report: "location": { "line": 20, "column": 28 - } + }, + "meta": {} } ], "startTime": 1697737019787, diff --git a/docs/guide/snapshot.md b/docs/guide/snapshot.md index 5fd0bc2c9..906cd231d 100644 --- a/docs/guide/snapshot.md +++ b/docs/guide/snapshot.md @@ -14,11 +14,7 @@ When using snapshot, Vitest will take a snapshot of the given value, then compar To snapshot a value, you can use the [`toMatchSnapshot()`](/api/expect#tomatchsnapshot) from `expect()` API: -```ts twoslash -function toUpperCase(str: string) { - return str -} -// ---cut--- +```ts import { expect, it } from 'vitest' it('toUpperCase', () => { @@ -45,11 +41,7 @@ When using Snapshots with async concurrent tests, `expect` from the local [Test Similarly, you can use the [`toMatchInlineSnapshot()`](/api/expect#tomatchinlinesnapshot) to store the snapshot inline within the test file. -```ts twoslash -function toUpperCase(str: string) { - return str -} -// ---cut--- +```ts import { expect, it } from 'vitest' it('toUpperCase', () => { @@ -60,11 +52,7 @@ it('toUpperCase', () => { Instead of creating a snapshot file, Vitest will modify the test file directly to update the snapshot as a string: -```ts twoslash -function toUpperCase(str: string) { - return str -} -// ---cut--- +```ts import { expect, it } from 'vitest' it('toUpperCase', () => { @@ -222,7 +210,7 @@ This does not really affect the functionality but might affect your commit diff Both Jest and Vitest's snapshots are powered by [`pretty-format`](https://github.com/facebook/jest/blob/main/packages/pretty-format). In Vitest we set `printBasicPrototype` default to `false` to provide a cleaner snapshot output, while in Jest <29.0.0 it's `true` by default. -```ts twoslash +```ts import { expect, test } from 'vitest' test('snapshot', () => { @@ -290,29 +278,18 @@ exports[`toThrowErrorMatchingSnapshot > hint 1`] = `[Error: error]`; #### 4. default `Error` snapshot is different for `toThrowErrorMatchingSnapshot` and `toThrowErrorMatchingInlineSnapshot` -```js twoslash +```js import { expect, test } from 'vitest' -// ---cut--- -test('snapshot', () => { - // - // in Jest - // +test('snapshot', () => { + // in Jest and Vitest expect(new Error('error')).toMatchInlineSnapshot(`[Error: error]`) // Jest snapshots `Error.message` for `Error` instance + // Vitest prints the same value as toMatchInlineSnapshot expect(() => { throw new Error('error') - }).toThrowErrorMatchingInlineSnapshot(`"error"`) - - // - // in Vitest - // - - expect(new Error('error')).toMatchInlineSnapshot(`[Error: error]`) - - expect(() => { - throw new Error('error') - }).toThrowErrorMatchingInlineSnapshot(`[Error: error]`) + }).toThrowErrorMatchingInlineSnapshot(`"error"`) // [!code --] + }).toThrowErrorMatchingInlineSnapshot(`[Error: error]`) // [!code ++] }) ``` diff --git a/docs/guide/test-context.md b/docs/guide/test-context.md index 88dd8e093..ea5f483dc 100644 --- a/docs/guide/test-context.md +++ b/docs/guide/test-context.md @@ -10,7 +10,7 @@ Inspired by [Playwright Fixtures](https://playwright.dev/docs/test-fixtures), Vi The first argument for each test callback is a test context. -```ts twoslash +```ts import { it } from 'vitest' it('should work', (ctx) => { @@ -29,7 +29,7 @@ A readonly object containing metadata about the test. The `expect` API bound to the current test: -```ts twoslash +```ts import { it } from 'vitest' it('math is easy', ({ expect }) => { @@ -39,7 +39,7 @@ it('math is easy', ({ expect }) => { This API is useful for running snapshot tests concurrently because global expect cannot track them: -```ts twoslash +```ts import { it } from 'vitest' it.concurrent('math is easy', ({ expect }) => { diff --git a/docs/guide/workspace.md b/docs/guide/workspace.md index 285c579f3..c52c1fd1c 100644 --- a/docs/guide/workspace.md +++ b/docs/guide/workspace.md @@ -51,7 +51,7 @@ If you are referencing filenames with glob pattern, make sure your config file s You can also define projects with inline config. Workspace file supports using both syntaxes at the same time. :::code-group -```ts [vitest.workspace.ts] twoslash +```ts [vitest.workspace.ts] import { defineWorkspace } from 'vitest/config' // defineWorkspace provides a nice type hinting DX diff --git a/docs/package.json b/docs/package.json index 89aebe5b1..4a100b3c9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -24,7 +24,7 @@ "@unocss/reset": "^0.61.5", "@vite-pwa/assets-generator": "^0.2.4", "@vite-pwa/vitepress": "^0.5.0", - "@vitejs/plugin-vue": "latest", + "@vitejs/plugin-vue": "^5.0.5", "fast-glob": "^3.3.2", "https-localhost": "^4.7.1", "unocss": "^0.61.5", diff --git a/eslint.config.js b/eslint.config.js index 6d2c55325..9e6d32aed 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -26,6 +26,8 @@ export default antfu( 'examples/**/mockServiceWorker.js', 'examples/sveltekit/.svelte-kit', 'packages/browser/**/esm-client-injector.js', + // contains technically invalid code to display pretty diff + 'docs/guide/snapshot.md', ], }, { diff --git a/packages/runner/src/hooks.ts b/packages/runner/src/hooks.ts index 44ea8eea2..aa8ae3a82 100644 --- a/packages/runner/src/hooks.ts +++ b/packages/runner/src/hooks.ts @@ -26,12 +26,13 @@ function getDefaultHookTimeout() { * @param {Function} fn - The callback function to be executed before all tests. * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. * @returns {void} - * * @example + * ```ts * // Example of using beforeAll to set up a database connection * beforeAll(async () => { * await database.connect(); * }); + * ``` */ export function beforeAll(fn: BeforeAllListener, timeout?: number): void { return getCurrentSuite().on( @@ -49,12 +50,13 @@ export function beforeAll(fn: BeforeAllListener, timeout?: number): void { * @param {Function} fn - The callback function to be executed after all tests. * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. * @returns {void} - * * @example + * ```ts * // Example of using afterAll to close a database connection * afterAll(async () => { * await database.disconnect(); * }); + * ``` */ export function afterAll(fn: AfterAllListener, timeout?: number): void { return getCurrentSuite().on( @@ -72,12 +74,13 @@ export function afterAll(fn: AfterAllListener, timeout?: number): void { * @param {Function} fn - The callback function to be executed before each test. This function receives an `TestContext` parameter if additional test context is needed. * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. * @returns {void} - * * @example + * ```ts * // Example of using beforeEach to reset a database state * beforeEach(async () => { * await database.reset(); * }); + * ``` */ export function beforeEach( fn: BeforeEachListener, @@ -98,12 +101,13 @@ export function beforeEach( * @param {Function} fn - The callback function to be executed after each test. This function receives an `TestContext` parameter if additional test context is needed. * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. * @returns {void} - * * @example + * ```ts * // Example of using afterEach to delete temporary files created during a test * afterEach(async () => { * await fileSystem.deleteTempFiles(); * }); + * ``` */ export function afterEach( fn: AfterEachListener, @@ -125,12 +129,13 @@ export function afterEach( * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. * @throws {Error} Throws an error if the function is not called within a test. * @returns {void} - * * @example + * ```ts * // Example of using onTestFailed to log failure details * onTestFailed(({ errors }) => { * console.log(`Test failed: ${test.name}`, errors); * }); + * ``` */ export const onTestFailed: TaskHook = createTestHook( 'onTestFailed', @@ -154,13 +159,14 @@ export const onTestFailed: TaskHook = createTestHook( * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. * @throws {Error} Throws an error if the function is not called within a test. * @returns {void} - * * @example + * ```ts * // Example of using onTestFinished for cleanup * const db = await connectToDatabase(); * onTestFinished(async () => { * await db.disconnect(); * }); + * ``` */ export const onTestFinished: TaskHook = createTestHook( 'onTestFinished', diff --git a/packages/runner/src/suite.ts b/packages/runner/src/suite.ts index 93c6cf4bd..0c3cfaf1b 100644 --- a/packages/runner/src/suite.ts +++ b/packages/runner/src/suite.ts @@ -45,8 +45,8 @@ import { getCurrentTest } from './test-state' * * @param {string} name - The name of the suite, used for identification and reporting. * @param {Function} fn - A function that defines the tests and suites within this suite. - * * @example + * ```ts * // Define a suite with two tests * suite('Math operations', () => { * test('should add two numbers', () => { @@ -57,8 +57,9 @@ import { getCurrentTest } from './test-state' * expect(subtract(5, 2)).toBe(3); * }); * }); - * + * ``` * @example + * ```ts * // Define nested suites * suite('String operations', () => { * suite('Trimming', () => { @@ -73,6 +74,7 @@ import { getCurrentTest } from './test-state' * }); * }); * }); + * ``` */ export const suite: SuiteAPI = createSuite() /** @@ -82,18 +84,20 @@ export const suite: SuiteAPI = createSuite() * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided. * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters. * @throws {Error} If called inside another test function. - * * @example + * ```ts * // Define a simple test * test('should add two numbers', () => { * expect(add(1, 2)).toBe(3); * }); - * + * ``` * @example + * ```ts * // Define a test with options * test('should subtract two numbers', { retry: 3 }, () => { * expect(subtract(5, 2)).toBe(3); * }); + * ``` */ export const test: TestAPI = createTest(function ( name: string | Function, @@ -120,8 +124,8 @@ export const test: TestAPI = createTest(function ( * * @param {string} name - The name of the suite, used for identification and reporting. * @param {Function} fn - A function that defines the tests and suites within this suite. - * * @example + * ```ts * // Define a suite with two tests * describe('Math operations', () => { * test('should add two numbers', () => { @@ -132,8 +136,9 @@ export const test: TestAPI = createTest(function ( * expect(subtract(5, 2)).toBe(3); * }); * }); - * + * ``` * @example + * ```ts * // Define nested suites * describe('String operations', () => { * describe('Trimming', () => { @@ -148,6 +153,7 @@ export const test: TestAPI = createTest(function ( * }); * }); * }); + * ``` */ export const describe: SuiteAPI = suite /** @@ -157,18 +163,20 @@ export const describe: SuiteAPI = suite * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided. * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters. * @throws {Error} If called inside another test function. - * * @example + * ```ts * // Define a simple test * it('adds two numbers', () => { * expect(add(1, 2)).toBe(3); * }); - * + * ``` * @example + * ```ts * // Define a test with options * it('subtracts two numbers', { retry: 3 }, () => { * expect(subtract(5, 2)).toBe(3); * }); + * ``` */ export const it: TestAPI = test diff --git a/packages/vitest/src/integrations/vi.ts b/packages/vitest/src/integrations/vi.ts index 3c6296b49..51828778e 100644 --- a/packages/vitest/src/integrations/vi.ts +++ b/packages/vitest/src/integrations/vi.ts @@ -97,8 +97,8 @@ export interface VitestUtils { /** * Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock). - * * @example + * ```ts * const cart = { * getApples: () => 42 * } @@ -108,6 +108,7 @@ export interface VitestUtils { * expect(cart.getApples()).toBe(10) * expect(spy).toHaveBeenCalled() * expect(spy).toHaveReturnedWith(10) + * ``` */ spyOn: typeof spyOn @@ -115,8 +116,8 @@ export interface VitestUtils { * Creates a spy on a function, though can be initiated without one. Every time a function is invoked, it stores its call arguments, returns, and instances. Also, you can manipulate its behavior with [methods](https://vitest.dev/api/mock). * * If no function is given, mock will return `undefined`, when invoked. - * * @example + * ```ts * const getApples = vi.fn(() => 0) * * getApples() @@ -128,6 +129,7 @@ export interface VitestUtils { * * expect(getApples()).toBe(5) * expect(getApples).toHaveNthReturnedWith(2, 5) + * ``` */ fn: typeof fn @@ -135,8 +137,8 @@ export interface VitestUtils { * Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out. * * This is very useful when you need to wait for some asynchronous action to complete, for example, when you start a server and need to wait for it to start. - * * @example + * ```ts * const server = createServer() * * await vi.waitFor( @@ -150,6 +152,7 @@ export interface VitestUtils { * interval: 20, // default is 50 * } * ) + * ``` */ waitFor: typeof waitFor @@ -157,8 +160,8 @@ export interface VitestUtils { * This is similar to [`vi.waitFor`](https://vitest.dev/api/vi#vi-waitfor), but if the callback throws any errors, execution is immediately interrupted and an error message is received. * * If the callback returns a falsy value, the next check will continue until a truthy value is returned. This is useful when you need to wait for something to exist before taking the next step. - * * @example + * ```ts * const element = await vi.waitUntil( * () => document.querySelector('.element'), * { @@ -169,6 +172,7 @@ export interface VitestUtils { * * // do something with the element * expect(element.querySelector('.element-child')).toBeTruthy() + * ``` */ waitUntil: typeof waitUntil @@ -234,11 +238,13 @@ export interface VitestUtils { * Imports module, bypassing all checks if it should be mocked. * Can be useful if you want to mock module partially. * @example + * ```ts * vi.mock('./example.js', async () => { * const axios = await vi.importActual('./example.js') * * return { ...axios, get: vi.fn() } * }) + * ``` * @param path Path to the module. Can be aliased, if your config supports it */ importActual: (path: string) => Promise @@ -248,9 +254,11 @@ export interface VitestUtils { * * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules). * @example + * ```ts * const example = await vi.importMock('./example.js') * example.calc.mockReturnValue(10) * expect(example.calc()).toBe(10) + * ``` * @param path Path to the module. Can be aliased, if your config supports it * @returns Fully mocked module */ @@ -264,6 +272,7 @@ export interface VitestUtils { * When `partial` is `true` it will expect a `Partial` as a return value. By default, this will only make TypeScript believe that * the first level values are mocked. You can pass down `{ deep: true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually is. * @example + * ```ts * import example from './example.js' * vi.mock('./example.js') * @@ -271,6 +280,7 @@ export interface VitestUtils { * vi.mocked(example.calc).mockReturnValue(10) * expect(example.calc(1, '+', 1)).toBe(10) * }) + * ``` * @param item Anything that can be mocked * @param deep If the object is deeply mocked * @param options If the object is partially or deeply mocked diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index 055a05387..fa980b08a 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -167,7 +167,7 @@ export const cliOptionsConfig: VitestCLIOptions = { outputFile: { argument: '', description: - 'Write test results to a file when supporter reporter is also specified, use cac\'s dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt)', + 'Write test results to a file when supporter reporter is also specified, use cac\'s dot notation for individual outputs of multiple reporters (example: `--outputFile.tap=./tap.txt`)', subcommands: null, }, coverage: { @@ -527,7 +527,7 @@ export const cliOptionsConfig: VitestCLIOptions = { }, seed: { description: - 'Set the randomization seed. This option will have no effect if --sequence.shuffle is falsy. Visit ["Random Seed" page](https://en.wikipedia.org/wiki/Random_seed) for more information', + 'Set the randomization seed. This option will have no effect if `--sequence.shuffle` is falsy. Visit ["Random Seed" page](https://en.wikipedia.org/wiki/Random_seed) for more information', argument: '', }, hooks: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61083db27..2aacb66e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -147,7 +147,7 @@ importers: specifier: ^0.5.0 version: 0.5.0(@vite-pwa/assets-generator@0.2.4)(vite-plugin-pwa@0.20.0(@vite-pwa/assets-generator@0.2.4)(vite@5.3.3(@types/node@20.14.11)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0)) '@vitejs/plugin-vue': - specifier: latest + specifier: ^5.0.5 version: 5.0.5(vite@5.3.3(@types/node@20.14.11)(terser@5.22.0))(vue@3.4.33(typescript@5.5.4)) fast-glob: specifier: ^3.3.2 @@ -9534,7 +9534,7 @@ snapshots: '@babel/helper-builder-binary-assignment-operator-visitor@7.22.15': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.24.9 '@babel/helper-compilation-targets@7.23.6': dependencies: @@ -9575,21 +9575,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-create-class-features-plugin@7.24.7(@babel/core@7.24.7)': - dependencies: - '@babel/core': 7.24.7 - '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-environment-visitor': 7.24.7 - '@babel/helper-function-name': 7.24.7 - '@babel/helper-member-expression-to-functions': 7.24.7 - '@babel/helper-optimise-call-expression': 7.24.7 - '@babel/helper-replace-supers': 7.24.7(@babel/core@7.24.7) - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/helper-split-export-declaration': 7.24.7 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - '@babel/helper-create-class-features-plugin@7.24.7(@babel/core@7.24.9)': dependencies: '@babel/core': 7.24.9 @@ -9605,17 +9590,17 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-create-regexp-features-plugin@7.22.15(@babel/core@7.24.7)': + '@babel/helper-create-regexp-features-plugin@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-annotate-as-pure': 7.24.7 regexpu-core: 5.3.2 semver: 6.3.1 - '@babel/helper-define-polyfill-provider@0.4.3(@babel/core@7.24.7)': + '@babel/helper-define-polyfill-provider@0.4.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-compilation-targets': 7.24.7 + '@babel/core': 7.24.9 + '@babel/helper-compilation-targets': 7.24.8 '@babel/helper-plugin-utils': 7.24.7 debug: 4.3.5 lodash.debounce: 4.0.8 @@ -9623,10 +9608,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-define-polyfill-provider@0.6.1(@babel/core@7.24.7)': + '@babel/helper-define-polyfill-provider@0.6.1(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-compilation-targets': 7.24.7 + '@babel/core': 7.24.9 + '@babel/helper-compilation-targets': 7.24.8 '@babel/helper-plugin-utils': 7.24.7 debug: 4.3.5 lodash.debounce: 4.0.8 @@ -9743,9 +9728,9 @@ snapshots: '@babel/helper-plugin-utils@7.24.7': {} - '@babel/helper-remap-async-to-generator@7.22.20(@babel/core@7.24.7)': + '@babel/helper-remap-async-to-generator@7.22.20(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-annotate-as-pure': 7.24.7 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-wrap-function': 7.22.20 @@ -9759,15 +9744,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-replace-supers@7.24.7(@babel/core@7.24.7)': - dependencies: - '@babel/core': 7.24.7 - '@babel/helper-environment-visitor': 7.24.7 - '@babel/helper-member-expression-to-functions': 7.24.7 - '@babel/helper-optimise-call-expression': 7.24.7 - transitivePeerDependencies: - - supports-color - '@babel/helper-replace-supers@7.24.7(@babel/core@7.24.9)': dependencies: '@babel/core': 7.24.9 @@ -9817,7 +9793,7 @@ snapshots: dependencies: '@babel/helper-function-name': 7.24.7 '@babel/template': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.24.9 '@babel/helpers@7.24.5': dependencies: @@ -9860,67 +9836,67 @@ snapshots: dependencies: '@babel/types': 7.24.9 - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.22.15(@babel/core@7.24.7)': + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.22.15(@babel/core@7.24.7)': + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/plugin-transform-optional-chaining': 7.23.0(@babel/core@7.24.7) + '@babel/plugin-transform-optional-chaining': 7.23.0(@babel/core@7.24.9) transitivePeerDependencies: - supports-color - '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.24.7)': + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 - '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.24.7)': + '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.24.7)': + '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.24.7)': + '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-import-assertions@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-syntax-import-assertions@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-import-attributes@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-syntax-import-attributes@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.24.7)': + '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-jsx@7.24.1(@babel/core@7.24.5)': @@ -9938,44 +9914,44 @@ snapshots: '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.24.7)': + '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.24.7)': + '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.24.7)': + '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.24.7)': + '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.24.7)': + '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.23.3)': @@ -9988,154 +9964,154 @@ snapshots: '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.24.7)': + '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-arrow-functions@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-arrow-functions@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-async-generator-functions@7.23.2(@babel/core@7.24.7)': + '@babel/plugin-transform-async-generator-functions@7.23.2(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 - '@babel/helper-remap-async-to-generator': 7.22.20(@babel/core@7.24.7) - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.7) + '@babel/helper-remap-async-to-generator': 7.22.20(@babel/core@7.24.9) + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.9) - '@babel/plugin-transform-async-to-generator@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-async-to-generator@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-module-imports': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 - '@babel/helper-remap-async-to-generator': 7.22.20(@babel/core@7.24.7) + '@babel/helper-remap-async-to-generator': 7.22.20(@babel/core@7.24.9) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-block-scoped-functions@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-block-scoped-functions@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-block-scoping@7.23.0(@babel/core@7.24.7)': + '@babel/plugin-transform-block-scoping@7.23.0(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-class-properties@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-class-properties@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-class-static-block@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-class-static-block@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.7) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.9) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-classes@7.22.15(@babel/core@7.24.7)': + '@babel/plugin-transform-classes@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-compilation-targets': 7.24.7 + '@babel/helper-compilation-targets': 7.24.8 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-function-name': 7.24.7 '@babel/helper-optimise-call-expression': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 - '@babel/helper-replace-supers': 7.24.7(@babel/core@7.24.7) + '@babel/helper-replace-supers': 7.24.7(@babel/core@7.24.9) '@babel/helper-split-export-declaration': 7.24.7 globals: 11.12.0 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-computed-properties@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-computed-properties@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/template': 7.24.7 - '@babel/plugin-transform-destructuring@7.23.0(@babel/core@7.24.7)': + '@babel/plugin-transform-destructuring@7.23.0(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-dotall-regex@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-dotall-regex@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-duplicate-keys@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-duplicate-keys@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-dynamic-import@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-dynamic-import@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-transform-exponentiation-operator@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-exponentiation-operator@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-builder-binary-assignment-operator-visitor': 7.22.15 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-export-namespace-from@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-export-namespace-from@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-transform-for-of@7.22.15(@babel/core@7.24.7)': + '@babel/plugin-transform-for-of@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-function-name@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-function-name@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-compilation-targets': 7.24.7 + '@babel/core': 7.24.9 + '@babel/helper-compilation-targets': 7.24.8 '@babel/helper-function-name': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-json-strings@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-json-strings@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-transform-literals@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-literals@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-logical-assignment-operators@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-logical-assignment-operators@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.7) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.9) - '@babel/plugin-transform-member-expression-literals@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-member-expression-literals@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-modules-amd@7.23.0(@babel/core@7.24.7)': + '@babel/plugin-transform-modules-amd@7.23.0(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-module-transforms': 7.24.7(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-module-transforms': 7.24.9(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 transitivePeerDependencies: - supports-color @@ -10149,15 +10125,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-commonjs@7.24.7(@babel/core@7.24.7)': - dependencies: - '@babel/core': 7.24.7 - '@babel/helper-module-transforms': 7.24.7(@babel/core@7.24.7) - '@babel/helper-plugin-utils': 7.24.7 - '@babel/helper-simple-access': 7.24.7 - transitivePeerDependencies: - - supports-color - '@babel/plugin-transform-modules-commonjs@7.24.7(@babel/core@7.24.9)': dependencies: '@babel/core': 7.24.9 @@ -10167,105 +10134,105 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-systemjs@7.23.0(@babel/core@7.24.7)': + '@babel/plugin-transform-modules-systemjs@7.23.0(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-hoist-variables': 7.24.7 - '@babel/helper-module-transforms': 7.24.7(@babel/core@7.24.7) + '@babel/helper-module-transforms': 7.24.9(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 '@babel/helper-validator-identifier': 7.24.7 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-umd@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-modules-umd@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-module-transforms': 7.24.7(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-module-transforms': 7.24.9(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-named-capturing-groups-regex@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-named-capturing-groups-regex@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-new-target@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-new-target@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-nullish-coalescing-operator@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-nullish-coalescing-operator@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-transform-numeric-separator@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-numeric-separator@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.7) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.9) - '@babel/plugin-transform-object-rest-spread@7.22.15(@babel/core@7.24.7)': + '@babel/plugin-transform-object-rest-spread@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/compat-data': 7.24.7 - '@babel/core': 7.24.7 - '@babel/helper-compilation-targets': 7.24.7 + '@babel/compat-data': 7.24.9 + '@babel/core': 7.24.9 + '@babel/helper-compilation-targets': 7.24.8 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-transform-parameters': 7.22.15(@babel/core@7.24.7) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-transform-parameters': 7.22.15(@babel/core@7.24.9) - '@babel/plugin-transform-object-super@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-object-super@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/helper-replace-supers': 7.24.7(@babel/core@7.24.7) + '@babel/helper-replace-supers': 7.24.7(@babel/core@7.24.9) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-optional-catch-binding@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-optional-catch-binding@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-transform-optional-chaining@7.23.0(@babel/core@7.24.7)': + '@babel/plugin-transform-optional-chaining@7.23.0(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.9) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-parameters@7.22.15(@babel/core@7.24.7)': + '@babel/plugin-transform-parameters@7.22.15(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-private-methods@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-private-methods@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-private-property-in-object@7.22.11(@babel/core@7.24.7)': + '@babel/plugin-transform-private-property-in-object@7.22.11(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.7) + '@babel/helper-create-class-features-plugin': 7.24.7(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.24.7) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.24.9) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-property-literals@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-property-literals@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-transform-react-jsx-development@7.22.5(@babel/core@7.24.5)': @@ -10292,43 +10259,43 @@ snapshots: '@babel/plugin-syntax-jsx': 7.24.1(@babel/core@7.24.5) '@babel/types': 7.24.5 - '@babel/plugin-transform-regenerator@7.22.10(@babel/core@7.24.7)': + '@babel/plugin-transform-regenerator@7.22.10(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 regenerator-transform: 0.15.2 - '@babel/plugin-transform-reserved-words@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-reserved-words@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-shorthand-properties@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-shorthand-properties@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-spread@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-spread@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-sticky-regex@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-sticky-regex@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-template-literals@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-template-literals@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-typeof-symbol@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-typeof-symbol@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-transform-typescript@7.24.7(@babel/core@7.23.3)': @@ -10351,120 +10318,120 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/plugin-transform-unicode-escapes@7.22.10(@babel/core@7.24.7)': + '@babel/plugin-transform-unicode-escapes@7.22.10(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-unicode-property-regex@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-unicode-property-regex@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-unicode-regex@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-unicode-regex@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/plugin-transform-unicode-sets-regex@7.22.5(@babel/core@7.24.7)': + '@babel/plugin-transform-unicode-sets-regex@7.22.5(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 - '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-create-regexp-features-plugin': 7.22.15(@babel/core@7.24.9) '@babel/helper-plugin-utils': 7.24.7 - '@babel/preset-env@7.23.2(@babel/core@7.24.7)': + '@babel/preset-env@7.23.2(@babel/core@7.24.9)': dependencies: - '@babel/compat-data': 7.24.7 - '@babel/core': 7.24.7 - '@babel/helper-compilation-targets': 7.24.7 + '@babel/compat-data': 7.24.9 + '@babel/core': 7.24.9 + '@babel/helper-compilation-targets': 7.24.8 '@babel/helper-plugin-utils': 7.24.7 - '@babel/helper-validator-option': 7.24.7 - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.22.15(@babel/core@7.24.7) - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.22.15(@babel/core@7.24.7) - '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.24.7) - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.7) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.24.7) - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.7) - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-import-assertions': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-syntax-import-attributes': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.7) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.7) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.7) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.7) - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.24.7) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.24.7) - '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.24.7) - '@babel/plugin-transform-arrow-functions': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-async-generator-functions': 7.23.2(@babel/core@7.24.7) - '@babel/plugin-transform-async-to-generator': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-block-scoped-functions': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-block-scoping': 7.23.0(@babel/core@7.24.7) - '@babel/plugin-transform-class-properties': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-class-static-block': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-classes': 7.22.15(@babel/core@7.24.7) - '@babel/plugin-transform-computed-properties': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-destructuring': 7.23.0(@babel/core@7.24.7) - '@babel/plugin-transform-dotall-regex': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-duplicate-keys': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-dynamic-import': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-exponentiation-operator': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-export-namespace-from': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-for-of': 7.22.15(@babel/core@7.24.7) - '@babel/plugin-transform-function-name': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-json-strings': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-literals': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-logical-assignment-operators': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-member-expression-literals': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-modules-amd': 7.23.0(@babel/core@7.24.7) - '@babel/plugin-transform-modules-commonjs': 7.24.7(@babel/core@7.24.7) - '@babel/plugin-transform-modules-systemjs': 7.23.0(@babel/core@7.24.7) - '@babel/plugin-transform-modules-umd': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-named-capturing-groups-regex': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-new-target': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-nullish-coalescing-operator': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-numeric-separator': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-object-rest-spread': 7.22.15(@babel/core@7.24.7) - '@babel/plugin-transform-object-super': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-optional-catch-binding': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-optional-chaining': 7.23.0(@babel/core@7.24.7) - '@babel/plugin-transform-parameters': 7.22.15(@babel/core@7.24.7) - '@babel/plugin-transform-private-methods': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-private-property-in-object': 7.22.11(@babel/core@7.24.7) - '@babel/plugin-transform-property-literals': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-regenerator': 7.22.10(@babel/core@7.24.7) - '@babel/plugin-transform-reserved-words': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-shorthand-properties': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-spread': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-sticky-regex': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-template-literals': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-typeof-symbol': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-unicode-escapes': 7.22.10(@babel/core@7.24.7) - '@babel/plugin-transform-unicode-property-regex': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-unicode-regex': 7.22.5(@babel/core@7.24.7) - '@babel/plugin-transform-unicode-sets-regex': 7.22.5(@babel/core@7.24.7) - '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.24.7) - '@babel/types': 7.24.7 - babel-plugin-polyfill-corejs2: 0.4.10(@babel/core@7.24.7) - babel-plugin-polyfill-corejs3: 0.8.5(@babel/core@7.24.7) - babel-plugin-polyfill-regenerator: 0.5.3(@babel/core@7.24.7) + '@babel/helper-validator-option': 7.24.8 + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.22.15(@babel/core@7.24.9) + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.22.15(@babel/core@7.24.9) + '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.24.9) + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.9) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.24.9) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.9) + '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-import-assertions': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-syntax-import-attributes': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.9) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.9) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.9) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.9) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.24.9) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.24.9) + '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.24.9) + '@babel/plugin-transform-arrow-functions': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-async-generator-functions': 7.23.2(@babel/core@7.24.9) + '@babel/plugin-transform-async-to-generator': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-block-scoped-functions': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-block-scoping': 7.23.0(@babel/core@7.24.9) + '@babel/plugin-transform-class-properties': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-class-static-block': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-classes': 7.22.15(@babel/core@7.24.9) + '@babel/plugin-transform-computed-properties': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-destructuring': 7.23.0(@babel/core@7.24.9) + '@babel/plugin-transform-dotall-regex': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-duplicate-keys': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-dynamic-import': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-exponentiation-operator': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-export-namespace-from': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-for-of': 7.22.15(@babel/core@7.24.9) + '@babel/plugin-transform-function-name': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-json-strings': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-literals': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-logical-assignment-operators': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-member-expression-literals': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-modules-amd': 7.23.0(@babel/core@7.24.9) + '@babel/plugin-transform-modules-commonjs': 7.24.7(@babel/core@7.24.9) + '@babel/plugin-transform-modules-systemjs': 7.23.0(@babel/core@7.24.9) + '@babel/plugin-transform-modules-umd': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-named-capturing-groups-regex': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-new-target': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-nullish-coalescing-operator': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-numeric-separator': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-object-rest-spread': 7.22.15(@babel/core@7.24.9) + '@babel/plugin-transform-object-super': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-optional-catch-binding': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-optional-chaining': 7.23.0(@babel/core@7.24.9) + '@babel/plugin-transform-parameters': 7.22.15(@babel/core@7.24.9) + '@babel/plugin-transform-private-methods': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-private-property-in-object': 7.22.11(@babel/core@7.24.9) + '@babel/plugin-transform-property-literals': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-regenerator': 7.22.10(@babel/core@7.24.9) + '@babel/plugin-transform-reserved-words': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-shorthand-properties': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-spread': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-sticky-regex': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-template-literals': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-typeof-symbol': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-unicode-escapes': 7.22.10(@babel/core@7.24.9) + '@babel/plugin-transform-unicode-property-regex': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-unicode-regex': 7.22.5(@babel/core@7.24.9) + '@babel/plugin-transform-unicode-sets-regex': 7.22.5(@babel/core@7.24.9) + '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.24.9) + '@babel/types': 7.24.9 + babel-plugin-polyfill-corejs2: 0.4.10(@babel/core@7.24.9) + babel-plugin-polyfill-corejs3: 0.8.5(@babel/core@7.24.9) + babel-plugin-polyfill-regenerator: 0.5.3(@babel/core@7.24.9) core-js-compat: 3.37.1 semver: 6.3.1 transitivePeerDependencies: - supports-color - '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.24.7)': + '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.24.9)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.24.9 esutils: 2.0.3 '@babel/preset-typescript@7.23.2(@babel/core@7.23.3)': @@ -11164,9 +11131,9 @@ snapshots: '@remix-run/router@1.16.0': {} - '@rollup/plugin-babel@5.3.1(@babel/core@7.24.7)(@types/babel__core@7.20.5)(rollup@4.19.0)': + '@rollup/plugin-babel@5.3.1(@babel/core@7.24.9)(@types/babel__core@7.20.5)(rollup@4.19.0)': dependencies: - '@babel/core': 7.24.7 + '@babel/core': 7.24.9 '@babel/helper-module-imports': 7.24.7 '@rollup/pluginutils': 3.1.0(rollup@4.19.0) rollup: 4.19.0 @@ -12853,27 +12820,27 @@ snapshots: html-entities: 2.3.3 validate-html-nesting: 1.2.2 - babel-plugin-polyfill-corejs2@0.4.10(@babel/core@7.24.7): + babel-plugin-polyfill-corejs2@0.4.10(@babel/core@7.24.9): dependencies: - '@babel/compat-data': 7.24.7 - '@babel/core': 7.24.7 - '@babel/helper-define-polyfill-provider': 0.6.1(@babel/core@7.24.7) + '@babel/compat-data': 7.24.9 + '@babel/core': 7.24.9 + '@babel/helper-define-polyfill-provider': 0.6.1(@babel/core@7.24.9) semver: 6.3.1 transitivePeerDependencies: - supports-color - babel-plugin-polyfill-corejs3@0.8.5(@babel/core@7.24.7): + babel-plugin-polyfill-corejs3@0.8.5(@babel/core@7.24.9): dependencies: - '@babel/core': 7.24.7 - '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.24.9) core-js-compat: 3.37.1 transitivePeerDependencies: - supports-color - babel-plugin-polyfill-regenerator@0.5.3(@babel/core@7.24.7): + babel-plugin-polyfill-regenerator@0.5.3(@babel/core@7.24.9): dependencies: - '@babel/core': 7.24.7 - '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.24.9) transitivePeerDependencies: - supports-color @@ -18202,10 +18169,10 @@ snapshots: workbox-build@7.1.0(@types/babel__core@7.20.5): dependencies: '@apideck/better-ajv-errors': 0.3.6(ajv@8.12.0) - '@babel/core': 7.24.7 - '@babel/preset-env': 7.23.2(@babel/core@7.24.7) + '@babel/core': 7.24.9 + '@babel/preset-env': 7.23.2(@babel/core@7.24.9) '@babel/runtime': 7.24.4 - '@rollup/plugin-babel': 5.3.1(@babel/core@7.24.7)(@types/babel__core@7.20.5)(rollup@4.19.0) + '@rollup/plugin-babel': 5.3.1(@babel/core@7.24.9)(@types/babel__core@7.20.5)(rollup@4.19.0) '@rollup/plugin-node-resolve': 15.2.3(rollup@4.19.0) '@rollup/plugin-replace': 2.4.2(rollup@4.19.0) '@rollup/plugin-terser': 0.4.4(rollup@4.19.0) diff --git a/test/typescript/test-d/test.test-d.ts b/test/typescript/test-d/test.test-d.ts index 11ee3bd9e..4fbc1afff 100644 --- a/test/typescript/test-d/test.test-d.ts +++ b/test/typescript/test-d/test.test-d.ts @@ -1,3 +1,6 @@ +/* eslint-disable ts/prefer-ts-expect-error */ +/* eslint-disable ts/ban-ts-comment */ + import { google, type sheets_v4 } from 'googleapis' import { describe, expectTypeOf, test, vi } from 'vitest' @@ -24,7 +27,6 @@ describe('test', () => { }) test('ignored error', () => { - // eslint-disable-next-line ts/prefer-ts-expect-error, ts/ban-ts-comment // @ts-ignore 45 is not a string expectTypeOf(45).toEqualTypeOf() }) -- 2.51.2