Skip to content

Commit

Permalink
docs: fix typos (#2815)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lioness100 authored Feb 8, 2023
1 parent ab5f892 commit 2f87505
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions docs/advanced/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface VitestRunner {
*/
importFile(filepath: string, source: VitestRunnerImportSource): unknown
/**
* Publically available configuration.
* Publicly available configuration.
*/
config: VitestRunnerConfig
}
Expand Down Expand Up @@ -117,7 +117,7 @@ export const myCustomTask = function (name, fn) {
import { afterAll, beforeAll, describe, myCustomTask } from '../utils/custom.js'
import { gardener } from './gardener.js'

deccribe('take care of the garden', () => {
describe('take care of the garden', () => {
beforeAll(() => {
gardener.putWorkingClothes()
})
Expand All @@ -136,7 +136,7 @@ deccribe('take care of the garden', () => {
```

```bash
vitest ./garder/tasks.test.js
vitest ./garden/tasks.test.js
```

::: warning
Expand Down
2 changes: 1 addition & 1 deletion docs/api/expect-typeof.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@

- **Type:** `() => void`

This matcher checks, if provided type is a `functon`.
This matcher checks, if provided type is a `function`.

```ts
import { expectTypeOf } from 'vitest'
Expand Down
8 changes: 4 additions & 4 deletions docs/api/vi.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ test('importing the next module imports mocked one', () => {
test('change state', async () => {
const mod = await import('./some/path')
mod.changeLocalState('new value')
expect(mod.getlocalState()).toBe('new value')
expect(mod.getLocalState()).toBe('new value')
})

test('module has old state', async () => {
const mod = await import('./some/path')
expect(mod.getlocalState()).toBe('old value')
expect(mod.getLocalState()).toBe('old value')
})
```

Expand Down Expand Up @@ -402,7 +402,7 @@ import.meta.env.NODE_ENV === 'development'
```ts
import { vi } from 'vitest'

// `innerWidth` is "0" before callling stubGlobal
// `innerWidth` is "0" before calling stubGlobal

vi.stubGlobal('innerWidth', 100)

Expand Down Expand Up @@ -456,7 +456,7 @@ IntersectionObserver === undefined

- **Type:** `() => Vitest`

Calls every microtask that was queued by `proccess.nextTick`. This will also run all microtasks scheduled by themselves.
Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves.

## vi.runAllTimers

Expand Down
4 changes: 2 additions & 2 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ Use `provider` to select the tool for coverage collection.
- **Available for providers:** `'c8' | 'istanbul'`
- **CLI:** `--coverage.enabled`, `--coverage.enabled=false`

Enables coverage collection. Can be overriden using `--coverage` CLI option.
Enables coverage collection. Can be overridden using `--coverage` CLI option.

#### include

Expand Down Expand Up @@ -1157,7 +1157,7 @@ Options for configuring [typechecking](/guide/testing-types) test environment.

What tools to use for type checking. Vitest will spawn a process with certain parameters for easier parsing, depending on the type. Checker should implement the same output format as `tsc`.

You need to have a package installed to use typecheker:
You need to have a package installed to use typechecker:

- `tsc` requires `typescript` package
- `vue-tsc` requires `vue-tsc` package
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ interface PopulateOptions {
interface PopulateResult {
// a list of all keys that were copied, even if value doesn't exist on original object
keys: Set<string>
// a map of original object that might have been overriden with keys
// a map of original object that might have been overridden with keys
// you can return these values inside `teardown` function
originals: Map<string | symbol, any>
}
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ There is much more to MSW. You can access cookies and query parameters, define m

Whenever we test code that involves timeouts or intervals, instead of having our tests wait it out or timeout. We can speed up our tests by using "fake" timers by mocking calls to `setTimeout` and `setInterval`, too.

See the [`vi.usefaketimers` api section](/api/#vi-usefaketimers) for a more in depth detailed API description.
See the [`vi.useFakeTimers` api section](/api/#vi-usefaketimers) for a more in depth detailed API description.

### Example

Expand Down Expand Up @@ -486,7 +486,7 @@ vi.mock('some-path', () => {
method: vi.fn(),
}
}
// now everytime useObject() is called it will
// now every time that useObject() is called it will
// return the same object reference
return _cache
}
Expand Down
2 changes: 1 addition & 1 deletion packages/runner/src/types/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export interface VitestRunner {
*/
importFile(filepath: string, source: VitestRunnerImportSource): unknown
/**
* Publically available configuration.
* Publicly available configuration.
*/
config: VitestRunnerConfig
}
2 changes: 1 addition & 1 deletion packages/vitest/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const defaultCoverageExcludes = [
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
]

// These are the generic defaults for coverage. Providers may also set some provider speficic defaults.
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
export const coverageConfigDefaults: ResolvedCoverageOptions = {
provider: 'c8',
enabled: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/integrations/snapshot/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function setupSnapshotEnvironment(environment: SnapshotEnvironment) {
_snapshotEnvironment = environment
}

export function getSnapshotEnironment() {
export function getSnapshotEnvironment() {
if (!_snapshotEnvironment)
throw new Error('Snapshot environment is not setup')
return _snapshotEnvironment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type MagicString from 'magic-string'
import { lineSplitRE, offsetToLineNumber, positionToOffset } from '../../../utils/source-map'
import { getCallLastIndex } from '../../../utils'
import { getSnapshotEnironment } from '../env'
import { getSnapshotEnvironment } from '../env'

export interface InlineSnapshot {
snapshot: string
Expand All @@ -13,7 +13,7 @@ export interface InlineSnapshot {
export async function saveInlineSnapshots(
snapshots: Array<InlineSnapshot>,
) {
const environment = getSnapshotEnironment()
const environment = getSnapshotEnvironment()
const MagicString = (await import('magic-string')).default
const files = new Set(snapshots.map(i => i.file))
await Promise.all(Array.from(files).map(async (file) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/vitest/src/integrations/snapshot/port/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ParsedStack, SnapshotData, SnapshotMatchOptions, SnapshotResult, S
import { slash } from '../../../utils'
import { parseStacktrace } from '../../../utils/source-map'
import type { SnapshotEnvironment } from '../env'
import { getSnapshotEnironment } from '../env'
import { getSnapshotEnvironment } from '../env'
import type { InlineSnapshot } from './inlineSnapshot'
import { saveInlineSnapshots } from './inlineSnapshot'

Expand Down Expand Up @@ -83,14 +83,14 @@ export default class SnapshotState {
printBasicPrototype: false,
...options.snapshotFormat,
}
this._environment = getSnapshotEnironment()
this._environment = getSnapshotEnvironment()
}

static async create(
testFilePath: string,
options: SnapshotStateOptions,
) {
const environment = getSnapshotEnironment()
const environment = getSnapshotEnvironment()
const snapshotPath = await environment.resolvePath(testFilePath)
const content = await environment.readSnapshotFile(snapshotPath)
return new SnapshotState(testFilePath, snapshotPath, content, options)
Expand Down
6 changes: 3 additions & 3 deletions packages/vitest/src/integrations/snapshot/port/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'pretty-format'
import type { SnapshotData, SnapshotStateOptions } from '../../../types'
import { isObject } from '../../../utils'
import { getSnapshotEnironment } from '../env'
import { getSnapshotEnvironment } from '../env'
import { getSerializers } from './plugins'

// TODO: rewrite and clean up
Expand Down Expand Up @@ -133,7 +133,7 @@ function printBacktickString(str: string): string {

export async function ensureDirectoryExists(filePath: string) {
try {
const environment = getSnapshotEnironment()
const environment = getSnapshotEnvironment()
await environment.prepareDirectory(join(dirname(filePath)))
}
catch { }
Expand All @@ -147,7 +147,7 @@ export async function saveSnapshotFile(
snapshotData: SnapshotData,
snapshotPath: string,
) {
const environment = getSnapshotEnironment()
const environment = getSnapshotEnvironment()
const snapshots = Object.keys(snapshotData)
.sort(naturalCompare)
.map(
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/integrations/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class VitestUtils {
}

/**
* Reset enviromental variables to the ones that were available before first `vi.stubEnv` was called.
* Reset environmental variables to the ones that were available before first `vi.stubEnv` was called.
*/
public unstubAllEnvs() {
this._stubsEnv.forEach((original, name) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/vitest/src/node/reporters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ export abstract class BaseReporter implements Reporter {

async reportBenchmarkSummary(files: File[]) {
const logger = this.ctx.logger
const benchs = getTests(files)
const benches = getTests(files)

const topBenchs = benchs.filter(i => i.result?.benchmark?.rank === 1)
const topBenches = benches.filter(i => i.result?.benchmark?.rank === 1)

logger.log(`\n${c.cyan(c.inverse(c.bold(' BENCH ')))} ${c.cyan('Summary')}\n`)
for (const bench of topBenchs) {
for (const bench of topBenches) {
const group = bench.suite
if (!group)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ function formatNumber(number: number) {
const tableHead = ['name', 'hz', 'min', 'max', 'mean', 'p75', 'p99', 'p995', 'p999', 'rme', 'samples']

function renderTableHead(tasks: Task[]) {
const benchs = tasks
const benches = tasks
.map(i => i.meta?.benchmark ? i.result?.benchmark : undefined)
.filter(notNullish)
const allItems = benchs.map(renderBenchmarkItems).concat([tableHead])
const allItems = benches.map(renderBenchmarkItems).concat([tableHead])
return `${' '.repeat(3)}${tableHead.map((i, idx) => {
const width = Math.max(...allItems.map(i => i[idx].length))
return idx
Expand Down Expand Up @@ -69,10 +69,10 @@ function renderBenchmark(task: Benchmark, tasks: Task[]): string {
if (!result)
return task.name

const benchs = tasks
const benches = tasks
.map(i => i.meta?.benchmark ? i.result?.benchmark : undefined)
.filter(notNullish)
const allItems = benchs.map(renderBenchmarkItems).concat([tableHead])
const allItems = benches.map(renderBenchmarkItems).concat([tableHead])
const items = renderBenchmarkItems(result)
const padded = items.map((i, idx) => {
const width = Math.max(...allItems.map(i => i[idx].length))
Expand All @@ -95,7 +95,7 @@ function renderBenchmark(task: Benchmark, tasks: Task[]): string {
c.dim(padded[10]), // sample
result.rank === 1
? c.bold(c.green(' fastest'))
: result.rank === benchs.length && benchs.length > 2
: result.rank === benches.length && benches.length > 2
? c.bold(c.gray(' slowest'))
: '',
].join(' ')
Expand Down
6 changes: 3 additions & 3 deletions packages/vitest/src/node/reporters/renderers/listRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ function renderBenchmark(task: Benchmark, tasks: Task[]): string {
if (!result)
return task.name

const benchs = tasks
const benches = tasks
.map(i => i.meta?.benchmark ? i.result?.benchmark : undefined)
.filter(notNullish)

const allItems = benchs.map(renderBenchmarkItems)
const allItems = benches.map(renderBenchmarkItems)
const items = renderBenchmarkItems(result)
const padded = items.map((i, idx) => {
const width = Math.max(...allItems.map(i => i[idx].length))
Expand All @@ -80,7 +80,7 @@ function renderBenchmark(task: Benchmark, tasks: Task[]): string {
c.dim(` (${padded[4]} samples)`),
result.rank === 1
? c.bold(c.green(' fastest'))
: result.rank === benchs.length && benchs.length > 2
: result.rank === benches.length && benches.length > 2
? c.bold(c.gray(' slowest'))
: '',
].join('')
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/runtime/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const detectESM = (url: string, source: string | null) => {
}

// apply transformations only to libraries
// inline code proccessed by vite-node
// inline code processed by vite-node
// make Node pseudo ESM
export const resolve: Resolver = async (url, context, next) => {
const { parentURL } = context
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/typecheck/typechecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class Typechecker {
this._onWatcherRerun?.()
this._result.sourceErrors = []
this._result.files = []
this._tests = null // test structure migh've changed
this._tests = null // test structure might've changed
rerunTriggered = true
}
if (/Found \w+ errors*. Watching for/.test(output)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/types/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export type ResolvedCoverageOptions<T extends Provider = Provider> =

export interface BaseCoverageOptions {
/**
* Enables coverage collection. Can be overriden using `--coverage` CLI option.
* Enables coverage collection. Can be overridden using `--coverage` CLI option.
*
* @default false
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/web-worker/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function createClonedMessageEvent(data: any, transferOrOptions: StructuredSerial
})
}
if (clone !== 'none') {
debug('create message event, using polifylled structured clone')
debug('create message event, using polyfilled structured clone')
transfer?.length && console.warn(
'[@vitest/web-worker] `structuredClone` is not supported in this environment. '
+ 'Falling back to polyfill, your transferable options will be lost. '
Expand Down
2 changes: 1 addition & 1 deletion test/core/test/imports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test('dynamic absolute from root import works', async () => {
expect(stringTimeoutMod).toBe(variableTimeoutMod)
})

test('dynamic absolute with extension mport works', async () => {
test('dynamic absolute with extension import works', async () => {
const stringTimeoutMod = await import('./../src/timeout')

const timeoutPath = '/src/timeout.ts'
Expand Down
4 changes: 2 additions & 2 deletions test/core/test/serialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ describe('error serialize', () => {
Object.defineProperty(error, 'array', {
value: [{
get name() {
throw new Error('name cannnot be accessed')
throw new Error('name cannot be accessed')
},
}],
})
expect(serializeError(error)).toEqual({
array: [
{
name: '<unserializable>: name cannnot be accessed',
name: '<unserializable>: name cannot be accessed',
},
],
constructor: 'Function<Error>',
Expand Down
2 changes: 1 addition & 1 deletion test/core/test/stubs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('stubbing globals', () => {
vi.unstubAllGlobals()
})

it('overrites setter', () => {
it('overwrites setter', () => {
const descriptor = {
get: () => 'getter',
set: () => {},
Expand Down
6 changes: 3 additions & 3 deletions test/snapshots/tools/generate-inline-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { dirname, resolve } from 'pathe'

const dir = dirname(fileURLToPath(import.meta.url))

export async function generateInlineTest(templatePath, testpath) {
export async function generateInlineTest(templatePath, testPath) {
const template = await fs.readFile(templatePath, 'utf8')
await fs.writeFile(testpath, template)
console.log(`Generated ${testpath}`)
await fs.writeFile(testPath, template)
console.log(`Generated ${testPath}`)
}

const filepath = resolve(dir, '../test-update/snapshots-inline-js.test.js')
Expand Down
2 changes: 1 addition & 1 deletion test/web-worker/test/postMessage.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, it } from 'vitest'
import MyWorker from '../src/worker?worker'

it('throws syntax errorm if no arguments are provided', () => {
it('throws syntax error if no arguments are provided', () => {
const worker = new MyWorker()

// @ts-expect-error requires at least one argument
Expand Down

0 comments on commit 2f87505

Please sign in to comment.