From 5a6086856e76d908dee8aa0b6a702e242db3ef62 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 10:21:24 +0200 Subject: [PATCH] refactor: fix typos (#9950) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Ari Perkkiƶ --- docs/api/advanced/runner.md | 2 +- docs/api/browser/assertions.md | 4 ++-- docs/api/browser/context.md | 2 +- docs/api/test.md | 2 +- docs/config/browser/playwright.md | 2 +- docs/config/environment.md | 2 +- docs/config/experimental.md | 2 +- docs/config/pool.md | 2 +- docs/config/tags.md | 2 +- docs/guide/mocking/classes.md | 2 +- packages/browser-playwright/src/playwright.ts | 12 ++++++------ packages/browser/src/client/tester/tester.ts | 2 +- packages/browser/src/node/plugin.ts | 2 +- packages/runner/src/run.ts | 2 +- packages/spy/src/index.ts | 6 +++--- packages/ui/client/composables/explorer/utils.ts | 4 ++-- packages/ui/client/composables/navigation.ts | 2 +- packages/vitest/src/api/setup.ts | 2 +- packages/vitest/src/integrations/env/jsdom.ts | 2 +- packages/vitest/src/integrations/env/utils.ts | 4 ++-- packages/vitest/src/node/browser/sessions.ts | 2 +- packages/vitest/src/node/cache/fsModuleCache.ts | 2 +- packages/vitest/src/node/config/resolveConfig.ts | 2 +- packages/vitest/src/node/sequencers/BaseSequencer.ts | 4 ++-- packages/vitest/src/node/state.ts | 2 +- packages/vitest/src/node/watch-filter.ts | 4 ++-- .../src/runtime/moduleRunner/moduleEvaluator.ts | 2 +- .../vitest/src/runtime/moduleRunner/moduleRunner.ts | 2 +- packages/vitest/src/utils/traces.ts | 2 +- .../fixtures/expect-dom/toHaveTextContent.test.ts | 2 +- .../browser/fixtures/failing/failing.snaphot.test.ts | 2 +- test/browser/specs/runner.test.ts | 2 +- test/browser/test/findElement.test.ts | 2 +- .../fixtures/config/browser-define/vitest.config.ts | 2 +- .../no-module-runner/test/manual-mock.test.ts | 2 +- test/cli/fixtures/public-api/custom.spec.ts | 2 +- test/cli/test/config/browser-configs.test.ts | 4 ++-- test/cli/test/mocking.test.ts | 2 +- test/cli/test/public-api.test.ts | 2 +- test/core/test/environments/jsdom.spec.ts | 4 ++-- test/core/test/jest-mock.test.ts | 2 +- test/core/test/mocking/vi-fn.test-d.ts | 2 +- test/core/vite.config.ts | 2 +- test/coverage-test/fixtures/src/ignore-hints.ts | 2 +- test/coverage-test/test/file-outside-vite.test.ts | 2 +- test/test-utils/index.ts | 2 +- 46 files changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/api/advanced/runner.md b/docs/api/advanced/runner.md index 514336b74..fb8dd4515 100644 --- a/docs/api/advanced/runner.md +++ b/docs/api/advanced/runner.md @@ -198,7 +198,7 @@ interface Suite extends TaskBase { } ``` -Every task has a `suite` property that references a suite it is located in. If `test` or `describe` are initiated at the top level, they will not have a `suite` property (it will **not** be equal to `file`!). `File` also never has a `suite` property. It is useful to travers the tasks from the bottom up. +Every task has a `suite` property that references a suite it is located in. If `test` or `describe` are initiated at the top level, they will not have a `suite` property (it will **not** be equal to `file`!). `File` also never has a `suite` property. It is useful to traverse the tasks from the bottom up. ```ts interface Test extends TaskBase { diff --git a/docs/api/browser/assertions.md b/docs/api/browser/assertions.md index c6a2e7797..c6ae18b6a 100644 --- a/docs/api/browser/assertions.md +++ b/docs/api/browser/assertions.md @@ -336,11 +336,11 @@ This allows you to assert whether an element contains another element as a desce ```ts const ancestor = getByTestId('ancestor') const descendant = getByTestId('descendant') -const nonExistantElement = getByTestId('does-not-exist') +const nonExistingElement = getByTestId('does-not-exist') await expect.element(ancestor).toContainElement(descendant) await expect.element(descendant).not.toContainElement(ancestor) -await expect.element(ancestor).not.toContainElement(nonExistantElement) +await expect.element(ancestor).not.toContainElement(nonExistingElement) ``` ## toContainHTML diff --git a/docs/api/browser/context.md b/docs/api/browser/context.md index d4c7c2c5e..71f6e7bf7 100644 --- a/docs/api/browser/context.md +++ b/docs/api/browser/context.md @@ -241,7 +241,7 @@ Utility functions useful for custom render libraries. ```ts export const utils: { /** - * This is simillar to calling `page.elementLocator`, but it returns only + * This is similar to calling `page.elementLocator`, but it returns only * locator selectors. */ getElementLocatorSelectors(element: Element): LocatorSelectors diff --git a/docs/api/test.md b/docs/api/test.md index a6fad1d8d..4dda739ea 100644 --- a/docs/api/test.md +++ b/docs/api/test.md @@ -223,7 +223,7 @@ Whether this test run concurrently with other concurrent tests in the suite. - **Default:** `true` - **Alias:** [`test.sequential`](#test-sequential) -Whether tests run sequentially. When both `concurrent` and `sequential` are specified, `concurrent` takes precendence. +Whether tests run sequentially. When both `concurrent` and `sequential` are specified, `concurrent` takes precedence. ### skip diff --git a/docs/config/browser/playwright.md b/docs/config/browser/playwright.md index f576f1319..5f94445b1 100644 --- a/docs/config/browser/playwright.md +++ b/docs/config/browser/playwright.md @@ -164,7 +164,7 @@ await userEvent.click(page.getByRole('button'), { When enabled, Vitest uses Playwright's [persistent context](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context) instead of a regular browser context. This allows browser state (cookies, localStorage, DevTools settings, etc.) to persist between test runs. ::: warning -This option is ignored when running tests in parallel (e.g. when headless with [`fileParallelism`](/config/fileparallelism) enalbed) since persistent context cannot be shared across parallel sessions. +This option is ignored when running tests in parallel (e.g. when headless with [`fileParallelism`](/config/fileparallelism) enabled) since persistent context cannot be shared across parallel sessions. ::: - When set to `true`, the user data is stored in `./node_modules/.cache/vitest-playwright-user-data` diff --git a/docs/config/environment.md b/docs/config/environment.md index d359278be..66c6b80f4 100644 --- a/docs/config/environment.md +++ b/docs/config/environment.md @@ -82,7 +82,7 @@ export default { ``` ::: tip -The `viteEnvironment` field corresponde to the environment defined by the [Vite Environment API](https://vite.dev/guide/api-environment#environment-api). By default, Vite exposes `client` (for the browser) and `ssr` (for the server) environments. +The `viteEnvironment` field corresponds to the environment defined by the [Vite Environment API](https://vite.dev/guide/api-environment#environment-api). By default, Vite exposes `client` (for the browser) and `ssr` (for the server) environments. ::: Vitest also exposes `builtinEnvironments` through `vitest/environments` entry, in case you just want to extend it. You can read more about extending environments in [our guide](/guide/environment). diff --git a/docs/config/experimental.md b/docs/config/experimental.md index a9855901c..be80135db 100644 --- a/docs/config/experimental.md +++ b/docs/config/experimental.md @@ -336,7 +336,7 @@ Some features will not work due to the nature of `viteModuleRunner`, including: - `istanbul` coverage provider doesn't work because there is no transformation phase, use `v8` instead ::: warning Coverage Support -At the momemnt Vitest supports coverage via `v8` provider as long as files can be transformed into JavaScript. To transform TypeScript, Vitest uses [`module.stripTypeScriptTypes`](https://nodejs.org/api/module.html#modulestriptypescripttypescode-options) which is available in Node.js since v22.13. If you are using a custom [module loader](https://nodejs.org/api/module.html#customization-hooks), Vitest is not able to reuse it to transform files for analysis. +At the moment Vitest supports coverage via `v8` provider as long as files can be transformed into JavaScript. To transform TypeScript, Vitest uses [`module.stripTypeScriptTypes`](https://nodejs.org/api/module.html#modulestriptypescripttypescode-options) which is available in Node.js since v22.13. If you are using a custom [module loader](https://nodejs.org/api/module.html#customization-hooks), Vitest is not able to reuse it to transform files for analysis. ::: With regards to mocking, it is also important to point out that ES modules do not support property override. This means that code like this won't work anymore: diff --git a/docs/config/pool.md b/docs/config/pool.md index 434b87294..c94498188 100644 --- a/docs/config/pool.md +++ b/docs/config/pool.md @@ -32,7 +32,7 @@ Running code in a sandbox has some advantages (faster tests), but also comes wit ```ts try { - fs.writeFileSync('/doesnt exist') + fs.writeFileSync('/does-not-exist') } catch (err) { console.log(err instanceof Error) // false diff --git a/docs/config/tags.md b/docs/config/tags.md index c3ea02606..62bf99950 100644 --- a/docs/config/tags.md +++ b/docs/config/tags.md @@ -102,7 +102,7 @@ When a test has both tags, the `timeout` will be `30_000` because `flaky` has a Tags can define [test options](/api/test#test-options) that will be applied to every test marked with the tag. These options are merged with the test's own options, with the test's options taking precedence. ::: warning -The [`retry.condition`](/api/test#retry) can onle be a regexp because the config values need to be serialised. +The [`retry.condition`](/api/test#retry) can only be a regexp because the config values need to be serialised. Tags also cannot apply other [tags](/api/test#tags) via these options. ::: diff --git a/docs/guide/mocking/classes.md b/docs/guide/mocking/classes.md index abfebc77c..09f8b8cd7 100644 --- a/docs/guide/mocking/classes.md +++ b/docs/guide/mocking/classes.md @@ -154,5 +154,5 @@ You can also spy on getters and setters using the same method. ::: ::: danger -Using classes with `vi.fn()` was introduced in Vitest 4. Previously, you had to use `function` and `prototype` inheritence directly. See [v3 guide](https://v3.vitest.dev/guide/mocking.html#classes). +Using classes with `vi.fn()` was introduced in Vitest 4. Previously, you had to use `function` and `prototype` inheritance directly. See [v3 guide](https://v3.vitest.dev/guide/mocking.html#classes). ::: diff --git a/packages/browser-playwright/src/playwright.ts b/packages/browser-playwright/src/playwright.ts index cb79ff27e..36e53122d 100644 --- a/packages/browser-playwright/src/playwright.ts +++ b/packages/browser-playwright/src/playwright.ts @@ -260,7 +260,7 @@ export class PlaywrightBrowserProvider implements BrowserProvider { } private createMocker(): BrowserModuleMocker { - const idPreficates = new Map boolean>() + const idPredicates = new Map boolean>() const sessionIds = new Map() function createPredicate(sessionId: string, url: string) { @@ -296,7 +296,7 @@ export class PlaywrightBrowserProvider implements BrowserProvider { const ids = sessionIds.get(sessionId) || [] ids.push(moduleUrl.href) sessionIds.set(sessionId, ids) - idPreficates.set(predicateKey(sessionId, moduleUrl.href), predicate) + idPredicates.set(predicateKey(sessionId, moduleUrl.href), predicate) return predicate } @@ -374,9 +374,9 @@ export class PlaywrightBrowserProvider implements BrowserProvider { delete: async (sessionId: string, id: string): Promise => { const page = this.getPage(sessionId) const key = predicateKey(sessionId, id) - const predicate = idPreficates.get(key) + const predicate = idPredicates.get(key) if (predicate) { - await page.context().unroute(predicate).finally(() => idPreficates.delete(key)) + await page.context().unroute(predicate).finally(() => idPredicates.delete(key)) } }, clear: async (sessionId: string): Promise => { @@ -384,9 +384,9 @@ export class PlaywrightBrowserProvider implements BrowserProvider { const ids = sessionIds.get(sessionId) || [] const promises = ids.map((id) => { const key = predicateKey(sessionId, id) - const predicate = idPreficates.get(key) + const predicate = idPredicates.get(key) if (predicate) { - return page.context().unroute(predicate).finally(() => idPreficates.delete(key)) + return page.context().unroute(predicate).finally(() => idPredicates.delete(key)) } return null }) diff --git a/packages/browser/src/client/tester/tester.ts b/packages/browser/src/client/tester/tester.ts index 8481ad259..43a6b999f 100644 --- a/packages/browser/src/client/tester/tester.ts +++ b/packages/browser/src/client/tester/tester.ts @@ -145,7 +145,7 @@ async function prepareTestEnvironment(options: PrepareOptions) { const runner = await initiateRunner(state, mocker, config) getBrowserState().runner = runner - // webdiverio context depends on the iframe state, so we need to switch the context, + // webdriverio context depends on the iframe state, so we need to switch the context, // we delay this in case the user doesn't use any userEvent commands to avoid the overhead if (server.provider === 'webdriverio') { let switchPromise: Promise | null = null diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index cec8f16a0..d3e5cd5dc 100644 --- a/packages/browser/src/node/plugin.ts +++ b/packages/browser/src/node/plugin.ts @@ -334,7 +334,7 @@ export default (parentServer: ParentBrowserProject, base = '/'): Plugin[] => { }, transform(code, id) { if (id.includes(parentServer.vite.config.cacheDir) && id.includes('loupe.js')) { - // loupe bundle has a nastry require('util') call that leaves a warning in the console + // loupe bundle has a nasty require('util') call that leaves a warning in the console const utilRequire = 'nodeUtil = require_util();' return code.replace(utilRequire, ' '.repeat(utilRequire.length)) } diff --git a/packages/runner/src/run.ts b/packages/runner/src/run.ts index 99c19f6bd..09825491d 100644 --- a/packages/runner/src/run.ts +++ b/packages/runner/src/run.ts @@ -482,7 +482,7 @@ function sendTasksUpdate(runner: VitestRunner): void { const p = runner.onTaskUpdate?.(taskPacks, eventsPacks) if (p) { pendingTasksUpdates.push(p) - // remove successful promise to not grow array indefnitely, + // remove successful promise to not grow array indefinitely, // but keep rejections so finishSendTasksUpdate can handle them p.then( () => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p), 1), diff --git a/packages/spy/src/index.ts b/packages/spy/src/index.ts index 80a1e48bd..bd50f730b 100644 --- a/packages/spy/src/index.ts +++ b/packages/spy/src/index.ts @@ -245,7 +245,7 @@ export function fn( originalImplementation?: T, ): Mock { // if the function is already a mock, just return the same function, - // simillarly to how vi.spyOn() works + // similarly to how vi.spyOn() works if (originalImplementation != null && isMockFunction(originalImplementation)) { return originalImplementation as Mock } @@ -485,11 +485,11 @@ function createMock( // jest calls this before the implementation, but we have to resolve this _after_ // because we cannot do it before the `Reflect.construct` called the custom implementation. - // fortunetly, the constructor is always an empty functon because `prototypeMethods` + // fortunately, the constructor is always an empty function because `prototypeMethods` // are only used by the automocker, so this doesn't matter for (const prop of prototypeMembers) { const prototypeMock = returnValue[prop] - // the method was overidden because of inheritence, ignore it + // the method was overridden because of inheritance, ignore it // eslint-disable-next-line ts/no-use-before-define if (prototypeMock !== mock.prototype[prop]) { continue diff --git a/packages/ui/client/composables/explorer/utils.ts b/packages/ui/client/composables/explorer/utils.ts index 1e4cfb5a0..294ecb5a0 100644 --- a/packages/ui/client/composables/explorer/utils.ts +++ b/packages/ui/client/composables/explorer/utils.ts @@ -43,8 +43,8 @@ export function isSlowTestTask(task: Task) { return false } - const treshold = config.value.slowTestThreshold - return typeof treshold === 'number' && duration > treshold + const threshold = config.value.slowTestThreshold + return typeof threshold === 'number' && duration > threshold } export function getSortedRootTasks(sort: SortUIType, tasks = explorerTree.root.tasks) { diff --git a/packages/ui/client/composables/navigation.ts b/packages/ui/client/composables/navigation.ts index 550a219d7..0d422b33e 100644 --- a/packages/ui/client/composables/navigation.ts +++ b/packages/ui/client/composables/navigation.ts @@ -160,7 +160,7 @@ function calculateBrowserPanel() { // TODO: find a way to make this universal - maybe show browser separately(?) if (browserState?.provider === 'webdriverio') { const parentWindow = window.outerWidth * (panels.details.size / 100) - // 40 is 20px padding for each sice + // 40 is 20px padding for each side const tabWidth = ((viewport.value[0] + 20) / parentWindow) * 100 return tabWidth } diff --git a/packages/vitest/src/api/setup.ts b/packages/vitest/src/api/setup.ts index c04c4dd73..0ce87d4db 100644 --- a/packages/vitest/src/api/setup.ts +++ b/packages/vitest/src/api/setup.ts @@ -142,7 +142,7 @@ export function setup(ctx: Vitest, _server?: ViteDevServer): void { } catch {} - // TODO: store this in HTML reporter separetly + // TODO: store this in HTML reporter separately const transformDuration = ctx.state.metadata[projectName]?.duration[moduleNode.url]?.[0] if (transformDuration != null) { result.transformTime = transformDuration diff --git a/packages/vitest/src/integrations/env/jsdom.ts b/packages/vitest/src/integrations/env/jsdom.ts index dcf3dbe92..f6babd4d2 100644 --- a/packages/vitest/src/integrations/env/jsdom.ts +++ b/packages/vitest/src/integrations/env/jsdom.ts @@ -133,7 +133,7 @@ export default { 'AbortController', 'AbortSignal', 'URLSearchParams', - // URL and Request is overriden with a compat one + // URL and Request is overridden with a compat one // 'URL', // 'Request', ] as const diff --git a/packages/vitest/src/integrations/env/utils.ts b/packages/vitest/src/integrations/env/utils.ts index ce8ba1319..bbbeee5fb 100644 --- a/packages/vitest/src/integrations/env/utils.ts +++ b/packages/vitest/src/integrations/env/utils.ts @@ -52,7 +52,7 @@ export function populateGlobal( const originals = new Map() - const overridenKeys = new Set([...KEYS, ...options.additionalKeys || []]) + const overriddenKeys = new Set([...KEYS, ...options.additionalKeys || []]) const overrideObject = new Map() for (const key of keys) { @@ -62,7 +62,7 @@ export function populateGlobal( && !isClassLikeName(key) && win[key].bind(win) - if (overridenKeys.has(key) && key in global) { + if (overriddenKeys.has(key) && key in global) { originals.set(key, global[key]) } diff --git a/packages/vitest/src/node/browser/sessions.ts b/packages/vitest/src/node/browser/sessions.ts index 1ca4ce40e..4b1f72e1a 100644 --- a/packages/vitest/src/node/browser/sessions.ts +++ b/packages/vitest/src/node/browser/sessions.ts @@ -16,7 +16,7 @@ export class BrowserSessions { } createSession(sessionId: string, project: TestProject, pool: { reject: (error: Error) => void }): Promise { - // this promise only waits for the WS connection with the orhcestrator to be established + // this promise only waits for the WS connection with the orchestrator to be established const defer = createDefer() const timeout = setTimeout(() => { diff --git a/packages/vitest/src/node/cache/fsModuleCache.ts b/packages/vitest/src/node/cache/fsModuleCache.ts index ad947a16d..3ec17d2d8 100644 --- a/packages/vitest/src/node/cache/fsModuleCache.ts +++ b/packages/vitest/src/node/cache/fsModuleCache.ts @@ -212,7 +212,7 @@ export class FileSystemModuleCache { consumer: config.consumer, resolve: config.resolve, // plugins can have different options, so this is not the best key, - // but we canot access the options because there is no standard API for it + // but we cannot access the options because there is no standard API for it plugins: config.plugins .filter(p => p.api?.vitest?.experimental?.ignoreFsModuleCache !== true) .map(p => p.name), diff --git a/packages/vitest/src/node/config/resolveConfig.ts b/packages/vitest/src/node/config/resolveConfig.ts index 33cb2b545..26fe5673b 100644 --- a/packages/vitest/src/node/config/resolveConfig.ts +++ b/packages/vitest/src/node/config/resolveConfig.ts @@ -494,7 +494,7 @@ export function resolveConfig( resolvePath(file, resolved.root), ) - // Add hard-coded default coverage exclusions. These cannot be overidden by user config. + // Add hard-coded default coverage exclusions. These cannot be overridden by user config. // Override original exclude array for cases where user re-uses same object in test.exclude. resolved.coverage.exclude = [ ...resolved.coverage.exclude, diff --git a/packages/vitest/src/node/sequencers/BaseSequencer.ts b/packages/vitest/src/node/sequencers/BaseSequencer.ts index 942d933f9..e91a134a2 100644 --- a/packages/vitest/src/node/sequencers/BaseSequencer.ts +++ b/packages/vitest/src/node/sequencers/BaseSequencer.ts @@ -12,7 +12,7 @@ export class BaseSequencer implements TestSequencer { this.ctx = ctx } - // async so it can be extended by other sequelizers + // async so it can be extended by other sequencers public async shard(files: TestSpecification[]): Promise { const { config } = this.ctx const { index, count } = config.shard! @@ -31,7 +31,7 @@ export class BaseSequencer implements TestSequencer { .map(({ spec }) => spec) } - // async so it can be extended by other sequelizers + // async so it can be extended by other sequencers public async sort(files: TestSpecification[]): Promise { const cache = this.ctx.cache return [...files].sort((a, b) => { diff --git a/packages/vitest/src/node/state.ts b/packages/vitest/src/node/state.ts index 0feb63d98..89159941c 100644 --- a/packages/vitest/src/node/state.ts +++ b/packages/vitest/src/node/state.ts @@ -256,7 +256,7 @@ export class StateManager { } cancelFiles(files: FileSpecification[], project: TestProject): void { - // if we don't filter existing modules, they will be overriden by `collectFiles` + // if we don't filter existing modules, they will be overridden by `collectFiles` const nonRegisteredFiles = files.filter(({ filepath }) => { const relativePath = relative(project.config.root, filepath) const id = generateFileHash(relativePath, project.name) diff --git a/packages/vitest/src/node/watch-filter.ts b/packages/vitest/src/node/watch-filter.ts index bb28dfc37..02e882229 100644 --- a/packages/vitest/src/node/watch-filter.ts +++ b/packages/vitest/src/node/watch-filter.ts @@ -230,9 +230,9 @@ export class WatchFilter { } private restoreCursor() { - const cursortPos + const cursorPos = this.keywordOffset() + (this.currentKeyword?.length || 0) - this.write(`${ESC}${cursortPos}G`) + this.write(`${ESC}${cursorPos}G`) } private write(data: string) { diff --git a/packages/vitest/src/runtime/moduleRunner/moduleEvaluator.ts b/packages/vitest/src/runtime/moduleRunner/moduleEvaluator.ts index 47d331647..297840c70 100644 --- a/packages/vitest/src/runtime/moduleRunner/moduleEvaluator.ts +++ b/packages/vitest/src/runtime/moduleRunner/moduleEvaluator.ts @@ -86,7 +86,7 @@ export class VitestModuleEvaluator implements ModuleEvaluator { private convertIdToImportUrl(id: string) { // TODO: vitest returns paths for external modules, but Vite returns file:// // REMOVE WHEN VITE 6 SUPPORT IS OVER - // unfortunetly, there is a bug in Vite where ID is resolved incorrectly, so we can't return files until the fix is merged + // unfortunately, there is a bug in Vite where ID is resolved incorrectly, so we can't return files until the fix is merged // https://github.com/vitejs/vite/pull/20449 if (!isWindows || isBuiltin(id) || /^(?:node:|data:|http:|https:|file:)/.test(id)) { return id diff --git a/packages/vitest/src/runtime/moduleRunner/moduleRunner.ts b/packages/vitest/src/runtime/moduleRunner/moduleRunner.ts index d3049faec..be655b57f 100644 --- a/packages/vitest/src/runtime/moduleRunner/moduleRunner.ts +++ b/packages/vitest/src/runtime/moduleRunner/moduleRunner.ts @@ -102,7 +102,7 @@ export class VitestModuleRunner * Vite checks that the module has exports emulating the Node.js behaviour, * but Vitest is more relaxed. * - * We should keep the Vite behavour when there is a `strict` flag. + * We should keep the Vite behavior when there is a `strict` flag. * @internal */ processImport(exports: Record): Record { diff --git a/packages/vitest/src/utils/traces.ts b/packages/vitest/src/utils/traces.ts index c3cc2946c..dab9034f2 100644 --- a/packages/vitest/src/utils/traces.ts +++ b/packages/vitest/src/utils/traces.ts @@ -218,7 +218,7 @@ export class Traces { throw error } finally { - // end sync callbcak + // end sync callback if (!(result instanceof Promise)) { span.end() } diff --git a/test/browser/fixtures/expect-dom/toHaveTextContent.test.ts b/test/browser/fixtures/expect-dom/toHaveTextContent.test.ts index 316b3f1b4..273b2a70c 100644 --- a/test/browser/fixtures/expect-dom/toHaveTextContent.test.ts +++ b/test/browser/fixtures/expect-dom/toHaveTextContent.test.ts @@ -69,7 +69,7 @@ describe('.toHaveTextContent', () => { expect(container.querySelector('#parent')).toHaveTextContent('Step 1 of 4') }) - test('can handle multiple levels with content spread across decendants', () => { + test('can handle multiple levels with content spread across descendants', () => { const {container} = render(` Step diff --git a/test/browser/fixtures/failing/failing.snaphot.test.ts b/test/browser/fixtures/failing/failing.snaphot.test.ts index f843ae582..cf1b757fa 100644 --- a/test/browser/fixtures/failing/failing.snaphot.test.ts +++ b/test/browser/fixtures/failing/failing.snaphot.test.ts @@ -2,5 +2,5 @@ import { expect, test } from 'vitest' test('file snapshot', async () => { await expect('inaccessible snapshot content') - .toMatchFileSnapshot('/inaccesible/path') + .toMatchFileSnapshot('/inaccessible/path') }) diff --git a/test/browser/specs/runner.test.ts b/test/browser/specs/runner.test.ts index baf340383..5808d9e98 100644 --- a/test/browser/specs/runner.test.ts +++ b/test/browser/specs/runner.test.ts @@ -241,7 +241,7 @@ test(`stack trace points to correct file in every browser when failed`, async () expect(stderr).toContain('Failure screenshot') expect(stderr).toContain('__screenshots__/failing') - expect(stderr).toContain('Access denied to "/inaccesible/path".') + expect(stderr).toContain('Access denied to "/inaccessible/path".') // depending on the browser it references either `.toBe()` or `expect()` expect(stderr).toMatch(/failing.test.ts:11:(12|17)/) diff --git a/test/browser/test/findElement.test.ts b/test/browser/test/findElement.test.ts index 1a211f9d2..a9e8a3f25 100644 --- a/test/browser/test/findElement.test.ts +++ b/test/browser/test/findElement.test.ts @@ -32,7 +32,7 @@ test('locator.findElement fails if it cannot find the element', async () => { return locator.findElement({ timeout: 100 }) }).rejects.toThrow('Cannot find element with locator: getByRole(\'button\')') // Normally it would be 5: - // Immidiate, 0 (next tick), 20, 50, 100 + // Immediate, 0 (next tick), 20, 50, 100 // But on CI it can be less because resources are limited expect(elementsSpy.mock.calls.length).toBeGreaterThanOrEqual(3) }) diff --git a/test/cli/fixtures/config/browser-define/vitest.config.ts b/test/cli/fixtures/config/browser-define/vitest.config.ts index 98f5b13ab..96976ebb5 100644 --- a/test/cli/fixtures/config/browser-define/vitest.config.ts +++ b/test/cli/fixtures/config/browser-define/vitest.config.ts @@ -18,7 +18,7 @@ let config = defineConfig({ }, }) -if (process.env.BROWSER_DEFINE_TEST_PROEJCT === "true") { +if (process.env.BROWSER_DEFINE_TEST_PROJECT === "true") { config = defineConfig({ test: { projects: [config], diff --git a/test/cli/fixtures/no-module-runner/test/manual-mock.test.ts b/test/cli/fixtures/no-module-runner/test/manual-mock.test.ts index e91691601..155e5b513 100644 --- a/test/cli/fixtures/no-module-runner/test/manual-mock.test.ts +++ b/test/cli/fixtures/no-module-runner/test/manual-mock.test.ts @@ -77,7 +77,7 @@ test('exports are mocked', () => { }) test('importMock works', async () => { - // wasnt't mocked by vi.mock, but importMock did + // wasn't mocked by vi.mock, but importMock did const mockedUnmocked = await vi.importMock('../src/no-mock.ts') expect(vi.isMockFunction(mockedUnmocked.notMocked)).toBe(true) expect(mockedUnmocked.notMocked()).toBeUndefined() diff --git a/test/cli/fixtures/public-api/custom.spec.ts b/test/cli/fixtures/public-api/custom.spec.ts index dfef64d3f..8b50a8218 100644 --- a/test/cli/fixtures/public-api/custom.spec.ts +++ b/test/cli/fixtures/public-api/custom.spec.ts @@ -12,7 +12,7 @@ afterAll(({}, suite) => { }) test('custom', ({ task }) => { - task.meta.custom = 'some-custom-hanlder' + task.meta.custom = 'some-custom-handler' }) test.each([1, 2])('custom %s', () => { diff --git a/test/cli/test/config/browser-configs.test.ts b/test/cli/test/config/browser-configs.test.ts index 80b9878f6..58295859f 100644 --- a/test/cli/test/config/browser-configs.test.ts +++ b/test/cli/test/config/browser-configs.test.ts @@ -974,7 +974,7 @@ describe('[e2e] workspace configs are affected by the CLI options', () => { }) test('browser root', async () => { - process.env.BROWSER_DEFINE_TEST_PROEJCT = 'false' + process.env.BROWSER_DEFINE_TEST_PROJECT = 'false' const { testTree, stderr } = await runVitest({ root: './fixtures/config/browser-define', browser: { @@ -992,7 +992,7 @@ test('browser root', async () => { }) test('browser project', async () => { - process.env.BROWSER_DEFINE_TEST_PROEJCT = 'true' + process.env.BROWSER_DEFINE_TEST_PROJECT = 'true' const { testTree, stderr } = await runVitest({ root: './fixtures/config/browser-define', browser: { diff --git a/test/cli/test/mocking.test.ts b/test/cli/test/mocking.test.ts index 65dea4c07..8bba3e510 100644 --- a/test/cli/test/mocking.test.ts +++ b/test/cli/test/mocking.test.ts @@ -55,7 +55,7 @@ test('invalid packages', async () => { root: path.join(import.meta.dirname, '../fixtures/invalid-package'), }) - // requires Vite 8 for relaxed import analysis validataion + // requires Vite 8 for relaxed import analysis validation // https://github.com/vitejs/vite/pull/21601 if (rolldownVersion) { expect(stderr).toMatchInlineSnapshot(`""`) diff --git a/test/cli/test/public-api.test.ts b/test/cli/test/public-api.test.ts index e29bffda7..984434fe3 100644 --- a/test/cli/test/public-api.test.ts +++ b/test/cli/test/public-api.test.ts @@ -49,7 +49,7 @@ it.each([ expect(stdout).toContain('custom.spec.ts:14:1 > custom') const suiteMeta = { done: true } - const testMeta = { custom: 'some-custom-hanlder' } + const testMeta = { custom: 'some-custom-handler' } expect(finishedTestCaseMetas).toHaveLength(3) expect(finishedTestModuleMetas).toHaveLength(1) diff --git a/test/core/test/environments/jsdom.spec.ts b/test/core/test/environments/jsdom.spec.ts index 2dee767ce..c2d8ab6c5 100644 --- a/test/core/test/environments/jsdom.spec.ts +++ b/test/core/test/environments/jsdom.spec.ts @@ -124,7 +124,7 @@ describe('FormData', () => { }) // https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData#exceptions - test('cannot pass down form data from a FORM element with a non-sumbit sumbitter', async () => { + test('cannot pass down form data from a FORM element with a non-submit submitter', async () => { const form = document.createElement('form') document.body.append(form) const submitter = document.createElement('button') @@ -136,7 +136,7 @@ describe('FormData', () => { ) }) - test('cannot pass down form data from a FORM element with a sumbitter from a wrong form', async () => { + test('cannot pass down form data from a FORM element with a submitter from a wrong form', async () => { const form1 = document.createElement('form') const form2 = document.createElement('form') document.body.append(form1, form2) diff --git a/test/core/test/jest-mock.test.ts b/test/core/test/jest-mock.test.ts index 24d79cbea..566ae41ae 100644 --- a/test/core/test/jest-mock.test.ts +++ b/test/core/test/jest-mock.test.ts @@ -175,7 +175,7 @@ describe('jest mock compat layer', () => { spy.mockRestore() - // Sicne Vitest 4 this is a special case where + // Since Vitest 4 this is a special case where // vi.fn(impl) will always return impl, unless overridden expect(spy.getMockImplementation()).toBe(originalFn) diff --git a/test/core/test/mocking/vi-fn.test-d.ts b/test/core/test/mocking/vi-fn.test-d.ts index 97b35ebd2..54557c6b0 100644 --- a/test/core/test/mocking/vi-fn.test-d.ts +++ b/test/core/test/mocking/vi-fn.test-d.ts @@ -68,7 +68,7 @@ test('spy.mock when implementation is a normal function', () => { expectTypeOf(Mock).constructorParameters.toEqualTypeOf<[a: string, b?: number]>() }) -test('cann call a function mock with and without new', () => { +test('can call a function mock with and without new', () => { const Mock = vi.fn(function fn(this: any) { this.test = true }) diff --git a/test/core/vite.config.ts b/test/core/vite.config.ts index 5dcf02f97..ab7e3aad4 100644 --- a/test/core/vite.config.ts +++ b/test/core/vite.config.ts @@ -33,7 +33,7 @@ export default defineConfig({ } }, }, - // Use babel plugin since Oxc (Vite 8) doens't support ecma decorators out of the box + // Use babel plugin since Oxc (Vite 8) doesn't support ecma decorators out of the box // https://github.com/oxc-project/oxc/issues/9170#issuecomment-4072166491 !!rolldownVersion && (import('@rolldown/plugin-babel').then(({ default: babel }) => diff --git a/test/coverage-test/fixtures/src/ignore-hints.ts b/test/coverage-test/fixtures/src/ignore-hints.ts index c852b4487..1659d0006 100644 --- a/test/coverage-test/fixtures/src/ignore-hints.ts +++ b/test/coverage-test/fixtures/src/ignore-hints.ts @@ -14,7 +14,7 @@ export function third() { } export function fourth() { - return "fourh" + return "fourth" } /* istanbul ignore stop */ diff --git a/test/coverage-test/test/file-outside-vite.test.ts b/test/coverage-test/test/file-outside-vite.test.ts index 11e533909..3fcf73cd7 100644 --- a/test/coverage-test/test/file-outside-vite.test.ts +++ b/test/coverage-test/test/file-outside-vite.test.ts @@ -23,7 +23,7 @@ test('does not crash when file outside Vite is loaded (#5639)', async () => { } else { // On istanbul the instrumentation happens on Vite plugin, so files - // loaded outsite Vite should have 0% coverage + // loaded outside Vite should have 0% coverage expect(fileCoverage).toMatchInlineSnapshot(` { "branches": "0/0 (100%)", diff --git a/test/test-utils/index.ts b/test/test-utils/index.ts index 967c7bafc..8344a7a73 100644 --- a/test/test-utils/index.ts +++ b/test/test-utils/index.ts @@ -177,7 +177,7 @@ export async function runVitest( ...rest.env, ...cliOptions?.env, }, - // override cache config with the one that was used to run `vitest` formt the CLI + // override cache config with the one that was used to run `vitest` from the CLI experimental: { fsModuleCache: rest.experimental?.fsModuleCache ?? currentConfig.experimental.fsModuleCache, ...cliOptions?.experimental, -- 2.51.2