[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

chore: fix various typos (#7663)

authored by

Arya Emami and committed by
GitHub
(Mar 14, 2025, 9:20 AM +0100) 3fdee3da 29f5a848

+30 -30
+2 -2
docs/advanced/api/reporters.md
··· 52 52 This method is called when [Vitest](/advanced/api/vitest) was initiated or started, but before the tests were filtered. 53 53 54 54 ::: info 55 - Internally this method is called inside [`vitest.start`](/advanced/api/vitest#start), [`vitest.init`](/advanced/api/vitest#init) or [`vitest.mergeReports`](/advanced/api/vitest#mergereports). If you are using programmatic API, make sure to call either one dependning on your needs before calling [`vitest.runTestSpecifications`](/advanced/api/vitest#runtestspecifications), for example. Built-in CLI will always run methods in correct order. 55 + Internally this method is called inside [`vitest.start`](/advanced/api/vitest#start), [`vitest.init`](/advanced/api/vitest#init) or [`vitest.mergeReports`](/advanced/api/vitest#mergereports). If you are using programmatic API, make sure to call either one depending on your needs before calling [`vitest.runTestSpecifications`](/advanced/api/vitest#runtestspecifications), for example. Built-in CLI will always run methods in correct order. 56 56 ::: 57 57 58 58 Note that you can also get access to `vitest` instance from test cases, suites and test modules via a [`project`](/advanced/api/test-project) property, but it might also be useful to store a reference to `vitest` in this method. ··· 139 139 140 140 - `passed`: test run was finished normally and there are no errors 141 141 - `failed`: test run has at least one error (due to a syntax error during collection or an actual error during test execution) 142 - - `interrupted`: test was interruped by [`vitest.cancelCurrentRun`](/advanced/api/vitest#cancelcurrentrun) call or `Ctrl+C` was pressed in the terminal (note that it's still possible to have failed tests in this case) 142 + - `interrupted`: test was interrupted by [`vitest.cancelCurrentRun`](/advanced/api/vitest#cancelcurrentrun) call or `Ctrl+C` was pressed in the terminal (note that it's still possible to have failed tests in this case) 143 143 144 144 If Vitest didn't find any test files to run, this event will be invoked with empty arrays of modules and errors, and the state will depend on the value of [`config.passWithNoTests`](/config/#passwithnotests). 145 145
+1 -1
docs/advanced/api/test-project.md
··· 124 124 ``` 125 125 ::: 126 126 127 - The values can be provided dynamicaly. Provided value in tests will be updated on their next run. 127 + The values can be provided dynamically. Provided value in tests will be updated on their next run. 128 128 129 129 ::: tip 130 130 This method is also available to [global setup files](/config/#globalsetup) for cases where you cannot use the public API:
+1 -1
docs/advanced/api/test-specification.md
··· 33 33 34 34 ## testModule 35 35 36 - Instance of [`TestModule`](/advanced/api/test-module) assosiated with the specification. If test wasn't queued yet, this will be `undefined`. 36 + Instance of [`TestModule`](/advanced/api/test-module) associated with the specification. If test wasn't queued yet, this will be `undefined`. 37 37 38 38 ## pool <Badge type="warning">experimental</Badge> {#pool} 39 39
+5 -5
docs/advanced/api/vitest.md
··· 93 93 94 94 The global snapshot manager. Vitest keeps track of all snapshots using the `snapshot.add` method. 95 95 96 - You can get the latest summary of snapshots via the `vitest.snapshot.summay` property. 96 + You can get the latest summary of snapshots via the `vitest.snapshot.summary` property. 97 97 98 98 ## cache 99 99 ··· 130 130 131 131 Vitest exposes `provide` method which is a shorthand for `vitest.getRootProject().provide`. With this method you can pass down values from the main thread to tests. All values are checked with `structuredClone` before they are stored, but the values themselves are not cloned. 132 132 133 - To recieve the values in the test, you need to import `inject` method from `vitest` entrypont: 133 + To receive the values in the test, you need to import `inject` method from `vitest` entrypoint: 134 134 135 135 ```ts 136 136 import { inject } from 'vitest' ··· 172 172 function getProjectByName(name: string): TestProject 173 173 ``` 174 174 175 - This method returns the project by its name. Simillar to calling `vitest.projects.find`. 175 + This method returns the project by its name. Similar to calling `vitest.projects.find`. 176 176 177 177 ::: warning 178 178 In case the project doesn't exist, this method will return the root project - make sure to check the names again if the project you are looking for is the one returned. ··· 297 297 function clearSpecificationsCache(moduleId?: string): void 298 298 ``` 299 299 300 - Vitest automatically caches test specifications for each file when [`globTestSpecifications`](#globtestspecifications) or [`runTestSpecifications`](#runtestspecifications) is called. This method clears the cache for the given file or the whole cache alltogether depending on the first argument. 300 + Vitest automatically caches test specifications for each file when [`globTestSpecifications`](#globtestspecifications) or [`runTestSpecifications`](#runtestspecifications) is called. This method clears the cache for the given file or the whole cache altogether depending on the first argument. 301 301 302 302 ## runTestSpecifications 303 303 ··· 452 452 453 453 Closes all projects and exit the process. If `force` is set to `true`, the process will exit immediately after closing the projects. 454 454 455 - This method will also forcefuly call `process.exit()` if the process is still active after [`config.teardownTimeout`](/config/#teardowntimeout) milliseconds. 455 + This method will also forcefully call `process.exit()` if the process is still active after [`config.teardownTimeout`](/config/#teardowntimeout) milliseconds. 456 456 457 457 ## shouldKeepServer 458 458
+2 -2
docs/advanced/guide/tests.md
··· 71 71 } 72 72 ``` 73 73 74 - If you intend to keep the `Vitest` instance, make sure to at least call [`init`](/advanced/api/vitest#init). This will initialise reporters and the coverage provider, but won't run any tests. It is also recommended to enable the `watch` mode even if you don't intend to use the Vitest watcher, but want to keep the instance running. Vitest relies on this flag for some of its features to work correctly in a continous process. 74 + If you intend to keep the `Vitest` instance, make sure to at least call [`init`](/advanced/api/vitest#init). This will initialise reporters and the coverage provider, but won't run any tests. It is also recommended to enable the `watch` mode even if you don't intend to use the Vitest watcher, but want to keep the instance running. Vitest relies on this flag for some of its features to work correctly in a continuous process. 75 75 76 76 After reporters are initialised, use [`runTestSpecifications`](/advanced/api/vitest#runtestspecifications) or [`rerunTestSpecifications`](/advanced/api/vitest#reruntestspecifications) to run tests if manual run is required: 77 77 ··· 88 88 ``` 89 89 90 90 ::: warning 91 - The example above shows a potential usecase if you disable the default watcher behaviour. By default, Vitest already reruns tests if files change. 91 + The example above shows a potential use-case if you disable the default watcher behaviour. By default, Vitest already reruns tests if files change. 92 92 93 93 Also note that `getModuleSpecifications` will not resolve test files unless they were already processed by `globTestSpecifications`. If the file was just created, use `project.matchesGlobPattern` instead: 94 94
+1 -1
docs/guide/browser/locators.md
··· 381 381 382 382 - `exact: boolean` 383 383 384 - Whether the `text` is matched exactly: case-sensetive and whole-string. Disabled by default. This option is ignored if `text` is a regular expression. Note that exact match still trims whitespace. 384 + Whether the `text` is matched exactly: case-sensitive and whole-string. Disabled by default. This option is ignored if `text` is a regular expression. Note that exact match still trims whitespace. 385 385 386 386 #### See also 387 387
+2 -2
docs/guide/browser/multiple-setups.md
··· 2 2 3 3 Since Vitest 3, you can specify several different browser setups using the new [`browser.instances`](/guide/browser/config#browser-instances) option. 4 4 5 - The main advatage of using the `browser.instances` over the [workspace](/guide/workspace) is improved caching. Every project will use the same Vite server meaning the file transform and [dependency pre-bundling](https://vite.dev/guide/dep-pre-bundling.html) has to happen only once. 5 + The main advantage of using the `browser.instances` over the [workspace](/guide/workspace) is improved caching. Every project will use the same Vite server meaning the file transform and [dependency pre-bundling](https://vite.dev/guide/dep-pre-bundling.html) has to happen only once. 6 6 7 7 ## Several Browsers 8 8 ··· 128 128 firefox 129 129 ``` 130 130 131 - If you have several non-headless projects in CI (i.e. the `headless: false` is set manually in the config and not overriden in CI env), Vitest will fail the run and won't start any tests. 131 + If you have several non-headless projects in CI (i.e. the `headless: false` is set manually in the config and not overridden in CI env), Vitest will fail the run and won't start any tests. 132 132 133 133 The ability to run tests in headless mode is not affected by this. You can still run all instances in parallel as long as they don't have `headless: false`. 134 134 :::
+1 -1
docs/guide/browser/playwright.md
··· 74 74 ::: 75 75 76 76 ::: warning 77 - Vitest awlays sets `ignoreHTTPSErrors` to `true` in case your server is served via HTTPS and `serviceWorkers` to `'allow'` to support module mocking via [MSW](https://mswjs.io). 77 + Vitest always sets `ignoreHTTPSErrors` to `true` in case your server is served via HTTPS and `serviceWorkers` to `'allow'` to support module mocking via [MSW](https://mswjs.io). 78 78 79 79 It is also recommended to use [`test.browser.viewport`](/guide/browser/config#browser-headless) instead of specifying it here as it will be lost when tests are running in headless mode. 80 80 :::
+1 -1
packages/expect/src/jest-expect.ts
··· 578 578 }) 579 579 580 580 // manually compare array elements since `jestEquals` cannot 581 - // apply assymetric matcher to `undefined` array element. 581 + // apply asymmetric matcher to `undefined` array element. 582 582 function equalsArgumentArray(a: unknown[], b: unknown[]) { 583 583 return a.length === b.length && a.every((aItem, i) => 584 584 jestEquals(aItem, b[i], [...customTesters, iterableEquality]),
+2 -2
test/config/test/browser-configs.test.ts
··· 9 9 return vitest 10 10 } 11 11 12 - test('assignes names as browsers', async () => { 12 + test('assigns names as browsers', async () => { 13 13 const { projects } = await vitest({ 14 14 browser: { 15 15 enabled: true, ··· 45 45 ]) 46 46 }) 47 47 48 - test('filters projects with a wildecard', async () => { 48 + test('filters projects with a wildcard', async () => { 49 49 const { projects } = await vitest({ 50 50 project: 'chrom*', 51 51 browser: {
+1 -1
test/config/test/failures.test.ts
··· 426 426 expect(stderr).toMatch('"browser.instances" was set in the config, but the array is empty. Define at least one browser config.') 427 427 }) 428 428 429 - test('browser.name filteres all browser.instances are required', async () => { 429 + test('browser.name filters all browser.instances are required', async () => { 430 430 const { stderr } = await runVitest({ 431 431 browser: { 432 432 enabled: true,
+1 -1
test/reporters/tests/test-run.test.ts
··· 897 897 }) 898 898 899 899 describe('type checking', () => { 900 - test('typechking is reported correctly', async () => { 900 + test('typechecking is reported correctly', async () => { 901 901 const report = await run({ 902 902 'example-1.test-d.ts': ts` 903 903 test('first', () => {});
+2 -2
test/snapshots/test/inline-multiple-calls.test.ts
··· 13 13 const testFile = join(root, 'same.test.ts') 14 14 editFile(testFile, s => s.replace(/toMatchInlineSnapshot\(`.*`\)/gs, 'toMatchInlineSnapshot()')) 15 15 16 - // iniital run (create snapshot) 16 + // initial run (create snapshot) 17 17 let vitest = await runVitest({ 18 18 root, 19 19 include: [testFile], ··· 102 102 const testFile = join(root, 'same2.test.ts') 103 103 editFile(testFile, s => s.replace(/toMatchInlineSnapshot\(`.*`\)/gs, 'toMatchInlineSnapshot()')) 104 104 105 - // iniital run (create snapshot) 105 + // initial run (create snapshot) 106 106 let vitest = await runVitest({ 107 107 root, 108 108 include: [testFile],
+1 -1
test/snapshots/test/jest-image-snapshot.test.ts
··· 3 3 import { expect, test } from 'vitest' 4 4 import { runVitest } from '../../test-utils' 5 5 6 - test('jest-image-sapshot', async () => { 6 + test('jest-image-snapshot', async () => { 7 7 // cleanup snapshot 8 8 const root = join(import.meta.dirname, 'fixtures/jest-image-snapshot') 9 9 fs.rmSync(join(root, '__image_snapshots__'), { recursive: true, force: true })
+1 -1
packages/vitest/src/api/check.ts
··· 5 5 export function isValidApiRequest(config: ResolvedConfig, req: IncomingMessage): boolean { 6 6 const url = new URL(req.url ?? '', 'http://localhost') 7 7 8 - // validate token. token is injected in ui/tester/orchestrator html, which is cross origin proteced. 8 + // validate token. token is injected in ui/tester/orchestrator html, which is cross origin protected. 9 9 try { 10 10 const token = url.searchParams.get('token') 11 11 if (token && crypto.timingSafeEqual(
+1 -1
packages/vitest/src/node/specifications.ts
··· 55 55 f => ({ ...f, filename: resolve(dir, f.filename) }), 56 56 )) 57 57 58 - // Key is file and val sepcifies whether we have matched this file with testLocation 58 + // Key is file and val specifies whether we have matched this file with testLocation 59 59 const testLocHasMatch: { [f: string]: boolean } = {} 60 60 61 61 await Promise.all(this.vitest.projects.map(async (project) => {
+1 -1
test/coverage-test/fixtures/test/isolation-1-fixture.test.ts
··· 1 1 import { test } from "vitest"; 2 2 import { multiply, remainder, subtract, sum } from "../src/math"; 3 3 4 - test("Should run function sucessfully", async () => { 4 + test("Should run function successfully", async () => { 5 5 sum(1, 1); 6 6 subtract(1,2) 7 7 multiply(3,4)
+2 -2
packages/vitest/src/integrations/mock/timers.ts
··· 20 20 // | _fakingTime | _fakingDate | 21 21 // +-------------+-------------+ 22 22 // | false | falsy | initial 23 - // | false | truethy | vi.setSystemTime called first (for mocking only Date without fake timers) 23 + // | false | truthy | vi.setSystemTime called first (for mocking only Date without fake timers) 24 24 // | true | falsy | vi.useFakeTimers called first 25 - // | true | truethy | unreachable 25 + // | true | truthy | unreachable 26 26 private _fakingTime: boolean 27 27 private _fakingDate: Date | null 28 28 private _fakeTimers: FakeTimerWithContext
+1 -1
packages/vitest/src/node/reporters/summary.ts
··· 248 248 } 249 249 else { 250 250 // Run is about to end as there are less tests left than whole run had parallel at max. 251 - // Remove finished test immediatelly. 251 + // Remove finished test immediately. 252 252 this.removeTestModule(module.id) 253 253 } 254 254
+1 -1
packages/vitest/src/node/workspace/resolveWorkspace.ts
··· 216 216 217 217 if (project.config.browser.providerOptions) { 218 218 vitest.logger.warn( 219 - withLabel('yellow', 'Vitest', `"providerOptions"${originalName ? ` in "${originalName}" project` : ''} is ignored because it's overriden by the configs. To hide this warning, remove the "providerOptions" property from the browser configuration.`), 219 + withLabel('yellow', 'Vitest', `"providerOptions"${originalName ? ` in "${originalName}" project` : ''} is ignored because it's overridden by the configs. To hide this warning, remove the "providerOptions" property from the browser configuration.`), 220 220 ) 221 221 } 222 222