Skip to content

Commit

Permalink
chore: fix various typos
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Dec 11, 2024
1 parent 4e60333 commit bd8977b
Show file tree
Hide file tree
Showing 65 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion docs/advanced/guide/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions docs/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion docs/api/expect.md
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ test('spy function resolves bananas on a last call', async () => {

- **Type**: `(time: number, returnValue: any) => Awaitable<void>`

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.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/vi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/browser/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/browser/interactivity-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions docs/guide/browser/locators.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<button>Hello World</button>
Expand Down Expand Up @@ -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

Expand All @@ -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:

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -596,7 +596,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:

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/test-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
],
})
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/testing-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ This will pass, because it expects an error, but the word “answer” has a typ

```ts
// @ts-expect-error answer is not a string
assertType<string>(answr)
assertType<string>(answer)
```
:::

Expand Down
8 changes: 4 additions & 4 deletions packages/browser/jest-dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down Expand Up @@ -282,7 +282,7 @@ declare namespace matchers {
* <option value="avocado">Avocado</option>
* </select>
*
* <label for="mutiple-select-example">Fruits</label>
* <label for="multiple-select-example">Fruits</label>
* <select id="multiple-select-example" multiple>
* <option value="">Select a fruit...</option>
* <option value="banana" selected>Banana</option>
Expand Down Expand Up @@ -382,7 +382,7 @@ declare namespace matchers {
* expect(element).toHaveTextContent('Content')
* // to match the whole content
* expect(element).toHaveTextContent(/^Text Content$/)
* // to use case-insentive match
* // to use case-insensitive match
* expect(element).toHaveTextContent(/content$/i)
* expect(element).not.toHaveTextContent('content')
* @see
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/client/tester/dialog.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function showPopupWarning<T>(name: string, value: T, defaultValue?: T) {
return (...params: any[]) => {
const formatedParams = params.map(p => JSON.stringify(p)).join(', ')
const formattedParams = params.map(p => JSON.stringify(p)).join(', ')

console.warn(`Vitest encountered a \`${name}(${formatedParams})\` call that it cannot handle by default, so it returned \`${value}\`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
console.warn(`Vitest encountered a \`${name}(${formattedParams})\` call that it cannot handle by default, so it returned \`${value}\`. Read more in https://vitest.dev/guide/browser/#thread-blocking-dialogs.
If needed, mock the \`${name}\` call manually like:
\`\`\`
Expand All @@ -11,8 +11,8 @@ import { expect, vi } from "vitest"
vi.spyOn(window, "${name}")${
defaultValue ? `.mockReturnValue(${JSON.stringify(defaultValue)})` : ''
}
${name}(${formatedParams})
expect(${name}).toHaveBeenCalledWith(${formatedParams})
${name}(${formattedParams})
expect(${name}).toHaveBeenCalledWith(${formattedParams})
\`\`\``)
return value
}
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async function executeTests(method: 'run' | 'collect', files: string[]) {
(page[cleanupSymbol] as any)()
}
// need to cleanup for each tester
// since playwright keybaord API is stateful on page instance level
// since playwright keyboard API is stateful on page instance level
await userEvent.cleanup()
}
catch (error: any) {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/node/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function createBrowserPool(ctx: Vitest): ProcessPool {
isCancelled = true
})

// TODO: paralellize tests instead of running them sequentially (based on CPU?)
// TODO: parallelize tests instead of running them sequentially (based on CPU?)
for (const [project, files] of groupedFiles.entries()) {
if (isCancelled) {
break
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/src/jest-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ export function getObjectSubset(
subsetEquality,
])
) {
// return "expected" subset to avoid showing irrelavant toMatchObject diff
// return "expected" subset to avoid showing irrelevant toMatchObject diff
return subset
}

Expand Down
4 changes: 2 additions & 2 deletions packages/expect/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
const globalState = new WeakMap<ExpectStatic, MatcherState>()
const matchers = Object.create(null)
const customEqualityTesters: Array<Tester> = []
const assymetricMatchers = Object.create(null)
const asymmetricMatchers = Object.create(null)
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
get: () => globalState,
})
Expand All @@ -23,7 +23,7 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
}),
})
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
get: () => assymetricMatchers,
get: () => asymmetricMatchers,
})
}

Expand Down
4 changes: 2 additions & 2 deletions packages/mocker/EXPORTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineConfig({
})
```

Now you can call `vi.mock` in your code and the mocker should kick in automatially:
Now you can call `vi.mock` in your code and the mocker should kick in automatically:

```ts
import { mocked } from './some-module.js'
Expand Down Expand Up @@ -94,7 +94,7 @@ import { spyOn } from '@vitest/spy'
mockObject(
{
// this is needed because it can be used in vm context
globalContructors: {
globalConstructors: {
Object,
// ...
},
Expand Down
2 changes: 1 addition & 1 deletion packages/mocker/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export type {
ModuleMockerConfig,
ModuleMockerRPC,
ResolveIdResult,
ResolveMockResul,
ResolveMockResult,
} from './mocker'
4 changes: 2 additions & 2 deletions packages/mocker/src/browser/mocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export interface ResolveIdResult {
optimized: boolean
}

export interface ResolveMockResul {
export interface ResolveMockResult {
mockType: MockedModuleType
resolvedId: string
redirectUrl?: string | null
Expand All @@ -252,7 +252,7 @@ export interface ModuleMockerRPC {
id: string,
importer: string,
options: { mock: 'spy' | 'factory' | 'auto' }
) => Promise<ResolveMockResul>
) => Promise<ResolveMockResult>
}

export interface ModuleMockerConfig {
Expand Down
2 changes: 1 addition & 1 deletion packages/mocker/src/node/hoistMocksPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ interface CodeFrameGenerator {
(node: Positioned<Node>, id: string, code: string): string
}

// this is a fork of Vite SSR trandform
// this is a fork of Vite SSR transform
export function hoistMocks(
code: string,
id: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/mocker/src/node/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class ServerMockResolver {
}
const isOptimized = resolved.id.startsWith(withTrailingSlash(this.server.config.cacheDir))
let url: string
// normalise the URL to be acceptible by the browser
// normalise the URL to be acceptable by the browser
// https://github.com/vitejs/vite/blob/e833edf026d495609558fd4fb471cf46809dc369/packages/vite/src/node/plugins/importAnalysis.ts#L335
const root = this.server.config.root
if (resolved.id.startsWith(withTrailingSlash(root))) {
Expand Down
4 changes: 2 additions & 2 deletions packages/runner/src/suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function createSuiteCollector(
setFn(
task,
withTimeout(
withAwaitAsyncAssetions(withFixtures(handler, context), task),
withAwaitAsyncAssertions(withFixtures(handler, context), task),
options?.timeout ?? runner.config.testTimeout,
),
)
Expand Down Expand Up @@ -477,7 +477,7 @@ function createSuiteCollector(
return collector
}

function withAwaitAsyncAssetions<T extends (...args: any[]) => any>(fn: T, task: TaskPopulated): T {
function withAwaitAsyncAssertions<T extends (...args: any[]) => any>(fn: T, task: TaskPopulated): T {
return (async (...args: any[]) => {
await fn(...args)
// some async expect will be added to this array, in case user forget to await them
Expand Down
Loading

0 comments on commit bd8977b

Please sign in to comment.