From 8dd2071376893184bc3f7f59449cfc3cba06dec9 Mon Sep 17 00:00:00 2001 From: Arya Emami Date: Wed, 8 Jan 2025 07:21:45 -0600 Subject: [PATCH] chore: fix various typos (#7054) --- docs/advanced/guide/tests.md | 2 +- docs/api/assert.md | 4 ++-- docs/api/expect.md | 2 +- docs/api/index.md | 2 +- docs/api/vi.md | 2 +- docs/guide/browser/commands.md | 2 +- docs/guide/browser/interactivity-api.md | 2 +- docs/guide/browser/locators.md | 16 ++++++++-------- docs/guide/mocking.md | 2 +- docs/guide/reporters.md | 2 +- docs/guide/test-context.md | 2 +- packages/browser/jest-dom.d.ts | 8 ++++---- packages/browser/src/client/tester/dialog.ts | 8 ++++---- packages/browser/src/client/tester/tester.ts | 2 +- packages/browser/src/node/pool.ts | 2 +- packages/expect/src/jest-utils.ts | 2 +- packages/expect/src/state.ts | 4 ++-- packages/mocker/EXPORTS.md | 4 ++-- packages/mocker/src/browser/index.ts | 2 +- packages/mocker/src/browser/mocker.ts | 4 ++-- packages/mocker/src/node/hoistMocksPlugin.ts | 2 +- packages/mocker/src/node/resolver.ts | 2 +- packages/runner/src/suite.ts | 4 ++-- packages/spy/src/index.ts | 10 +++++----- packages/utils/src/diff/cleanupSemantic.ts | 4 ++-- packages/utils/src/error.ts | 2 +- packages/vite-node/src/source-map-handler.ts | 2 +- packages/vitest/src/create/browser/creator.ts | 2 +- packages/vitest/src/integrations/chai/index.ts | 2 +- packages/vitest/src/integrations/chai/poll.ts | 2 +- packages/vitest/src/node/core.ts | 4 ++-- packages/vitest/src/node/errors.ts | 2 +- packages/vitest/src/node/project.ts | 6 +++--- .../vitest/src/node/reporters/reported-tasks.ts | 2 +- packages/vitest/src/node/reporters/summary.ts | 4 ++-- packages/vitest/src/node/types/config.ts | 4 ++-- packages/vitest/src/node/viteLogger.ts | 2 +- .../src/node/workspace/resolveWorkspace.ts | 6 +++--- packages/vitest/src/runtime/external-executor.ts | 4 ++-- .../vitest/src/runtime/vm/commonjs-executor.ts | 2 +- test/README.md | 2 +- test/browser/specs/runner.test.ts | 2 +- test/browser/specs/update-snapshot.test.ts | 2 +- test/browser/test/polyfill-lib.test.ts | 2 +- test/browser/test/userEvent.test.ts | 2 +- test/cli/fixtures/vitest.config.js | 2 +- test/cli/test/fails.test.ts | 4 ++-- test/cli/test/stacktraces.test.ts | 2 +- test/core/test/env.test.ts | 2 +- test/core/test/mocked.test.ts | 2 +- .../core/test/snapshot-custom-serializer.test.ts | 2 +- test/core/test/test-extend.test.ts | 2 +- test/core/test/utils.spec.ts | 2 +- test/core/test/vi.spec.ts | 4 ++-- .../configs/vitest.config.multi-transform.ts | 4 ++-- test/coverage-test/test/include-exclude.test.ts | 2 +- test/reporters/tests/html.test.ts | 4 ++-- .../test/__snapshots__/runner.test.ts.snap | 2 +- test/typescript/test/runner.test.ts | 2 +- test/vite-node/test/sourcemap.test.ts | 10 +++++----- test/workspaces/globalTest.ts | 4 ++-- .../space_3/global-provide.space-3-test.ts | 2 +- test/workspaces/space_3/localSetup.ts | 2 +- 63 files changed, 103 insertions(+), 103 deletions(-) diff --git a/docs/advanced/guide/tests.md b/docs/advanced/guide/tests.md index a59dfd1bf87a..1e9ee1ac1e5b 100644 --- a/docs/advanced/guide/tests.md +++ b/docs/advanced/guide/tests.md @@ -8,7 +8,7 @@ Breaking changes might not follow SemVer, please pin Vitest's version when using Vitest exposes two methods to initiate Vitest: -- `startVitest` initiates Vitest, validates the packages are installed and runs tests immidiatly +- `startVitest` initiates Vitest, validates the packages are installed and runs tests immediately - `createVitest` only initiates Vitest and doesn't run any tests ## `startVitest` diff --git a/docs/api/assert.md b/docs/api/assert.md index e1993a4c06b2..707a7504aad0 100644 --- a/docs/api/assert.md +++ b/docs/api/assert.md @@ -282,7 +282,7 @@ Asserts that `value` is not null. ```ts import { assert, test } from 'vitest' -const error = { message: 'error was occured' } +const error = { message: 'error was occurred' } test('assert.isNotNull', () => { assert.isNotNull(error, 'error is not null but object') @@ -298,7 +298,7 @@ Asserts that `value` is NaN. ```ts import { assert, test } from 'vitest' -const calculation = 1 * 'viitest' +const calculation = 1 * 'vitest' test('assert.isNaN', () => { assert.isNaN(calculation, '1 * "vitest" is NaN') diff --git a/docs/api/expect.md b/docs/api/expect.md index cb87254bf87f..ae4d77d5fa70 100644 --- a/docs/api/expect.md +++ b/docs/api/expect.md @@ -1236,7 +1236,7 @@ test('spy function resolves bananas on a last call', async () => { - **Type**: `(time: number, returnValue: any) => Awaitable` -You can call this assertion to check if a function has successfully resolved a certain value on a specific invokation. Requires a spy function to be passed to `expect`. +You can call this assertion to check if a function has successfully resolved a certain value on a specific invocation. Requires a spy function to be passed to `expect`. If the function returned a promise, but it was not resolved yet, this will fail. diff --git a/docs/api/index.md b/docs/api/index.md index 30dffaab226e..a269d94c9b13 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -1118,7 +1118,7 @@ Here the `afterAll` ensures that `stopMocking` method is called after all tests ## Test Hooks -Vitest provides a few hooks that you can call _during_ the test execution to cleanup the state when the test has finished runnning. +Vitest provides a few hooks that you can call _during_ the test execution to cleanup the state when the test has finished running. ::: warning These hooks will throw an error if they are called outside of the test body. diff --git a/docs/api/vi.md b/docs/api/vi.md index 35603155a082..b164721d3105 100644 --- a/docs/api/vi.md +++ b/docs/api/vi.md @@ -590,7 +590,7 @@ IntersectionObserver === undefined ## Fake Timers -This sections descibes how to work with [fake timers](/guide/mocking#timers). +This sections describes how to work with [fake timers](/guide/mocking#timers). ### vi.advanceTimersByTime diff --git a/docs/guide/browser/commands.md b/docs/guide/browser/commands.md index d00232caa106..2350a3bdebfb 100644 --- a/docs/guide/browser/commands.md +++ b/docs/guide/browser/commands.md @@ -127,7 +127,7 @@ Custom functions will override built-in ones if they have the same name. Vitest exposes several `playwright` specific properties on the command context. - `page` references the full page that contains the test iframe. This is the orchestrator HTML and you most likely shouldn't touch it to not break things. -- `frame` is an async method that will resolve tester [`Frame`](https://playwright.dev/docs/api/class-frame). It has a simillar API to the `page`, but it doesn't support certain methods. If you need to query an element, you should prefer using `context.iframe` instead because it is more stable and faster. +- `frame` is an async method that will resolve tester [`Frame`](https://playwright.dev/docs/api/class-frame). It has a similar API to the `page`, but it doesn't support certain methods. If you need to query an element, you should prefer using `context.iframe` instead because it is more stable and faster. - `iframe` is a [`FrameLocator`](https://playwright.dev/docs/api/class-framelocator) that should be used to query other elements on the page. - `context` refers to the unique [BrowserContext](https://playwright.dev/docs/api/class-browsercontext). diff --git a/docs/guide/browser/interactivity-api.md b/docs/guide/browser/interactivity-api.md index c0fefe926e6e..d76325af52e1 100644 --- a/docs/guide/browser/interactivity-api.md +++ b/docs/guide/browser/interactivity-api.md @@ -280,7 +280,7 @@ test('update input', async () => { ``` ::: info -Vitest doesn't expose `.type` method on the locator like `input.type` because it exists only for compatiblity with the `userEvent` library. Consider using `.fill` instead as it is faster. +Vitest doesn't expose `.type` method on the locator like `input.type` because it exists only for compatibility with the `userEvent` library. Consider using `.fill` instead as it is faster. ::: References: diff --git a/docs/guide/browser/locators.md b/docs/guide/browser/locators.md index b3775b1fc38e..d9b33c355101 100644 --- a/docs/guide/browser/locators.md +++ b/docs/guide/browser/locators.md @@ -65,7 +65,7 @@ Providing roles via `role` or `aria-*` attributes to built-in elements that alre - `exact: boolean` - Whether the `name` is matched exactly: case-sensetive and whole-string. Disabled by default. This option is ignored if `name` is a regular expression. Note that exact match still trims whitespace. + Whether the `name` is matched exactly: case-sensitive and whole-string. Disabled by default. This option is ignored if `name` is a regular expression. Note that exact match still trims whitespace. ```tsx @@ -213,7 +213,7 @@ page.getByAltText('non existing alt text') // ❌ - `exact: boolean` - 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. + 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. #### See also @@ -228,7 +228,7 @@ function getByLabelText( ): Locator ``` -Creates a locator capable of finding an element that has an assosiated label. +Creates a locator capable of finding an element that has an associated label. The `page.getByLabelText('Username')` locator will find every input in the example bellow: @@ -260,7 +260,7 @@ The `page.getByLabelText('Username')` locator will find every input in the examp - `exact: boolean` - 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. + 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. #### See also @@ -292,7 +292,7 @@ It is generally better to rely on a label using [`getByLabelText`](#getbylabelte - `exact: boolean` - 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. + 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. #### See also @@ -324,7 +324,7 @@ This locator is useful for locating non-interactive elements. If you need to loc - `exact: boolean` - 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. + 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. #### See also @@ -352,7 +352,7 @@ page.getByTitle('Create') // ❌ - `exact: boolean` - 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. + 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. #### See also @@ -659,7 +659,7 @@ function query(): Element | null This method returns a single element matching the locator's selector or `null` if no element is found. -If multilple elements match the selector, this method will throw an error. Use [`.elements()`](#elements) when you need all matching DOM Elements or [`.all()`](#all) if you need an array of locators matching the selector. +If multiple elements match the selector, this method will throw an error. Use [`.elements()`](#elements) when you need all matching DOM Elements or [`.all()`](#all) if you need an array of locators matching the selector. Consider the following DOM structure: diff --git a/docs/guide/mocking.md b/docs/guide/mocking.md index b3a48fb3b266..6793d76df3cb 100644 --- a/docs/guide/mocking.md +++ b/docs/guide/mocking.md @@ -10,7 +10,7 @@ When writing tests it's only a matter of time before you need to create a "fake" Always remember to clear or restore mocks before or after each test run to undo mock state changes between runs! See [`mockReset`](/api/mock#mockreset) docs for more info. ::: -If you are not familliar with `vi.fn`, `vi.mock` or `vi.spyOn` methods, check the [API section](/api/vi) first. +If you are not familiar with `vi.fn`, `vi.mock` or `vi.spyOn` methods, check the [API section](/api/vi) first. ## Dates diff --git a/docs/guide/reporters.md b/docs/guide/reporters.md index cced55e9c2d7..6aa83eededaa 100644 --- a/docs/guide/reporters.md +++ b/docs/guide/reporters.md @@ -513,7 +513,7 @@ export default defineConfig({ ### Blob Reporter Stores test results on the machine so they can be later merged using [`--merge-reports`](/guide/cli#merge-reports) command. -By default, stores all results in `.vitest-reports` folder, but can be overriden with `--outputFile` or `--outputFile.blob` flags. +By default, stores all results in `.vitest-reports` folder, but can be overridden with `--outputFile` or `--outputFile.blob` flags. ```bash npx vitest --reporter=blob --outputFile=reports/blob-1.json diff --git a/docs/guide/test-context.md b/docs/guide/test-context.md index 8b9a8c3be2a1..d0a8b000c5eb 100644 --- a/docs/guide/test-context.md +++ b/docs/guide/test-context.md @@ -190,7 +190,7 @@ const test = base.extend({ url: [ // default value if "url" is not defined in the config 'default', - // mark the fixure as "injected" to allow the override + // mark the fixture as "injected" to allow the override { injected: true }, ], }) diff --git a/packages/browser/jest-dom.d.ts b/packages/browser/jest-dom.d.ts index 43cf623241bf..ff0a540d7186 100644 --- a/packages/browser/jest-dom.d.ts +++ b/packages/browser/jest-dom.d.ts @@ -192,10 +192,10 @@ declare namespace matchers { * * const ancestor = getByTestId('ancestor') * const descendant = getByTestId('descendant') - * const nonExistantElement = getByTestId('does-not-exist') + * const nonExistentElement = getByTestId('does-not-exist') * expect(ancestor).toContainElement(descendant) * expect(descendant).not.toContainElement(ancestor) - * expect(ancestor).not.toContainElement(nonExistantElement) + * expect(ancestor).not.toContainElement(nonExistentElement) * @see * [testing-library/jest-dom#tocontainelement](https://github.com/testing-library/jest-dom#tocontainelement) */ @@ -282,7 +282,7 @@ declare namespace matchers { * * * - * + * *