From 7a31a1ae4223aed3adf260e63ac3b3f7fab3c9d7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:33:12 +0100 Subject: [PATCH] chore(deps): update dependency @antfu/eslint-config to v2 (#5153) --- README.md | 2 - docs/advanced/runner.md | 32 +- docs/api/expect.md | 4 +- docs/api/index.md | 1 - docs/config/index.md | 12 +- docs/guide/extending-matchers.md | 2 +- docs/guide/filtering.md | 2 +- docs/guide/migration.md | 3 - docs/guide/mocking.md | 1 - docs/guide/reporters.md | 3 - docs/guide/snapshot.md | 1 - docs/guide/ui.md | 1 - eslint.config.js | 14 +- examples/image-snapshot/test/basic.test.ts | 2 +- netlify.toml | 29 +- package.json | 2 +- packages/browser/package.json | 4 +- packages/browser/src/client/runner.ts | 16 +- packages/browser/src/client/utils.ts | 6 +- packages/coverage-istanbul/src/provider.ts | 4 +- packages/coverage-v8/src/provider.ts | 4 +- .../expect/src/jest-asymmetric-matchers.ts | 8 +- packages/expect/src/types.ts | 122 +++--- packages/runner/src/types/runner.ts | 55 ++- packages/runner/src/types/tasks.ts | 12 +- packages/snapshot/README.md | 2 +- packages/snapshot/src/types/environment.ts | 14 +- packages/spy/src/index.ts | 32 +- packages/ui/cypress/support/mount.ts | 2 +- packages/vite-node/src/hmr/emitter.ts | 9 +- packages/vite-node/src/source-map-handler.ts | 2 +- packages/vitest/package.json | 10 +- packages/vitest/src/api/types.ts | 56 +-- packages/vitest/src/integrations/vi.ts | 85 ++-- packages/vitest/src/node/globalSetup.ts | 2 +- packages/vitest/src/node/sequencers/types.ts | 4 +- packages/vitest/src/node/workspace.ts | 4 +- packages/vitest/src/runtime/runners/test.ts | 16 +- .../src/runtime/vm/commonjs-executor.ts | 2 +- .../vitest/src/runtime/workers/threads.ts | 5 +- packages/vitest/src/runtime/workers/types.ts | 4 +- .../vitest/src/runtime/workers/vmThreads.ts | 5 +- packages/vitest/src/types/benchmark.ts | 4 +- packages/vitest/src/types/browser.ts | 12 +- packages/vitest/src/types/coverage.ts | 22 +- packages/vitest/src/types/general.ts | 10 +- packages/vitest/src/types/global.ts | 31 +- packages/vitest/src/types/reporter.ts | 2 +- packages/vitest/src/types/worker.ts | 4 +- packages/vitest/src/utils/coverage.ts | 2 +- packages/ws-client/src/index.ts | 4 +- pnpm-lock.yaml | 384 +++++++++++------- test/core/test/jest-expect.test.ts | 10 +- test/core/test/utils.spec.ts | 2 +- test/coverage-test/custom-provider.ts | 2 +- .../test/configuration-options.test-d.ts | 2 +- 56 files changed, 609 insertions(+), 478 deletions(-) diff --git a/README.md b/README.md index 1882a36f2..1babe9962 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ Next generation testing framework powered by Vite. 中文文档

-

@@ -49,7 +48,6 @@ Next generation testing framework powered by Vite. > Vitest 1.0 requires Vite >=v5.0.0 and Node >=v18.0.0 - ```ts import { assert, describe, expect, it } from 'vitest' diff --git a/docs/advanced/runner.md b/docs/advanced/runner.md index c841ee035..da8bf1a99 100644 --- a/docs/advanced/runner.md +++ b/docs/advanced/runner.md @@ -11,69 +11,69 @@ export interface VitestRunner { /** * First thing that's getting called before actually collecting and running tests. */ - onBeforeCollect?(paths: string[]): unknown + onBeforeCollect?: (paths: string[]) => unknown /** * Called after collecting tests and before "onBeforeRun". */ - onCollected?(files: File[]): unknown + onCollected?: (files: File[]) => unknown /** * Called when test runner should cancel next test runs. * Runner should listen for this method and mark tests and suites as skipped in * "onBeforeRunSuite" and "onBeforeRunTask" when called. */ - onCancel?(reason: CancelReason): unknown + onCancel?: (reason: CancelReason) => unknown /** * Called before running a single test. Doesn't have "result" yet. */ - onBeforeRunTask?(test: TaskPopulated): unknown + onBeforeRunTask?: (test: TaskPopulated) => unknown /** * Called before actually running the test function. Already has "result" with "state" and "startTime". */ - onBeforeTryTask?(test: TaskPopulated, options: { retry: number; repeats: number }): unknown + onBeforeTryTask?: (test: TaskPopulated, options: { retry: number; repeats: number }) => unknown /** * Called after result and state are set. */ - onAfterRunTask?(test: TaskPopulated): unknown + onAfterRunTask?: (test: TaskPopulated) => unknown /** * Called right after running the test function. Doesn't have new state yet. Will not be called, if the test function throws. */ - onAfterTryTask?(test: TaskPopulated, options: { retry: number; repeats: number }): unknown + onAfterTryTask?: (test: TaskPopulated, options: { retry: number; repeats: number }) => unknown /** * Called before running a single suite. Doesn't have "result" yet. */ - onBeforeRunSuite?(suite: Suite): unknown + onBeforeRunSuite?: (suite: Suite) => unknown /** * Called after running a single suite. Has state and result. */ - onAfterRunSuite?(suite: Suite): unknown + onAfterRunSuite?: (suite: Suite) => unknown /** * If defined, will be called instead of usual Vitest suite partition and handling. * "before" and "after" hooks will not be ignored. */ - runSuite?(suite: Suite): Promise + runSuite?: (suite: Suite) => Promise /** * If defined, will be called instead of usual Vitest handling. Useful, if you have your custom test function. * "before" and "after" hooks will not be ignored. */ - runTask?(test: TaskPopulated): Promise + runTask?: (test: TaskPopulated) => Promise /** * Called, when a task is updated. The same as "onTaskUpdate" in a reporter, but this is running in the same thread as tests. */ - onTaskUpdate?(task: [string, TaskResult | undefined][]): Promise + onTaskUpdate?: (task: [string, TaskResult | undefined][]) => Promise /** * Called before running all tests in collected paths. */ - onBeforeRunFiles?(files: File[]): unknown + onBeforeRunFiles?: (files: File[]) => unknown /** * Called right after running all tests in collected paths. */ - onAfterRunFiles?(files: File[]): unknown + onAfterRunFiles?: (files: File[]) => unknown /** * Called when new context for a test is defined. Useful, if you want to add custom properties to the context. * If you only want to define custom context with a runner, consider using "beforeAll" in "setupFiles" instead. @@ -82,11 +82,11 @@ export interface VitestRunner { * * @see https://vitest.dev/advanced/runner.html#your-task-function */ - extendTaskContext?(context: TaskContext): TaskContext + extendTaskContext?: (context: TaskContext) => TaskContext /** * Called, when certain files are imported. Can be called in two situations: when collecting tests and when importing setup files. */ - importFile(filepath: string, source: VitestRunnerImportSource): unknown + importFile: (filepath: string, source: VitestRunnerImportSource) => unknown /** * Publicly available configuration. */ diff --git a/docs/api/expect.md b/docs/api/expect.md index 242251f48..5bf3ac2f4 100644 --- a/docs/api/expect.md +++ b/docs/api/expect.md @@ -1389,7 +1389,7 @@ If you are using TypeScript, since Vitest 0.31.0 you can extend default `Asserti ```ts interface CustomMatchers { - toBeFoo(): R + toBeFoo: () => R } declare module 'vitest' { @@ -1456,4 +1456,4 @@ expect.addEqualityTesters([areAnagramsEqual]) test('custom equality tester', () => { expect(new AnagramComparator('listen')).toEqual(new AnagramComparator('silent')) }) -``` \ No newline at end of file +``` diff --git a/docs/api/index.md b/docs/api/index.md index f24573091..7df39b390 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -209,7 +209,6 @@ test.todo.concurrent(/* ... */) // or test.concurrent.todo(/* ... */) When running concurrent tests, Snapshots and Assertions must use `expect` from the local [Test Context](/guide/test-context.md) to ensure the right test is detected. - ```ts test.concurrent('test 1', async ({ expect }) => { expect(foo).toMatchSnapshot() diff --git a/docs/config/index.md b/docs/config/index.md index e2690c3d4..cf0c627dc 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -702,7 +702,6 @@ Minimum number of threads. You can also use `VITEST_MIN_THREADS` environment var Run all tests with the same environment inside a single worker thread. This will disable built-in module isolation (your source code or [inlined](#deps-inline) code will still be reevaluated for each test), but can improve test performance. - :::warning Even though this option will force tests to run one after another, this option is different from Jest's `--runInBand`. Vitest uses workers not only for running tests in parallel, but also to provide isolation. By disabling this option, your tests will run sequentially, but in the same global context, so you must provide isolation yourself. @@ -782,7 +781,6 @@ Isolate environment for each test file. Run all tests with the same environment inside a single child process. This will disable built-in module isolation (your source code or [inlined](#deps-inline) code will still be reevaluated for each test), but can improve test performance. - :::warning Even though this option will force tests to run one after another, this option is different from Jest's `--runInBand`. Vitest uses child processes not only for running tests in parallel, but also to provide isolation. By disabling this option, your tests will run sequentially, but in the same global context, so you must provide isolation yourself. @@ -881,7 +879,6 @@ Pass additional arguments to `node` process in the VM context. See [Command-line Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103. ::: - #### poolOptions.vmForks Options for `vmForks` pool. @@ -1063,7 +1060,6 @@ declare module 'vitest' { ``` ::: - ### watchExclude - **Type:** `string[]` @@ -1557,10 +1553,10 @@ Path to a provider that will be used when running browser tests. Vitest provides ```ts export interface BrowserProvider { name: string - getSupportedBrowsers(): readonly string[] - initialize(ctx: Vitest, options: { browser: string; options?: BrowserProviderOptions }): Awaitable - openPage(url: string): Awaitable - close(): Awaitable + getSupportedBrowsers: () => readonly string[] + initialize: (ctx: Vitest, options: { browser: string; options?: BrowserProviderOptions }) => Awaitable + openPage: (url: string) => Awaitable + close: () => Awaitable } ``` diff --git a/docs/guide/extending-matchers.md b/docs/guide/extending-matchers.md index 8e9974339..82b542ef1 100644 --- a/docs/guide/extending-matchers.md +++ b/docs/guide/extending-matchers.md @@ -29,7 +29,7 @@ If you are using TypeScript, since Vitest 0.31.0 you can extend default `Asserti import type { Assertion, AsymmetricMatchersContaining } from 'vitest' interface CustomMatchers { - toBeFoo(): R + toBeFoo: () => R } declare module 'vitest' { diff --git a/docs/guide/filtering.md b/docs/guide/filtering.md index d3a5e82ff..462d3cf95 100644 --- a/docs/guide/filtering.md +++ b/docs/guide/filtering.md @@ -22,7 +22,7 @@ basic-foo.test.ts basic/foo.test.ts ``` -You can also use the `-t, --testNamePattern ` option to filter tests by full name. This can be helpful when you want to filter by the name defined within a file rather than the filename itself. +You can also use the `-t, --testNamePattern ` option to filter tests by full name. This can be helpful when you want to filter by the name defined within a file rather than the filename itself. ## Specifying a Timeout diff --git a/docs/guide/migration.md b/docs/guide/migration.md index c13233e52..2e82cc8b8 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -19,7 +19,6 @@ All `@vitest/*` sub packages require Vitest version 1.0. Quotes in snapshots are no longer escaped, and all snapshots use backtick quotes (`) even if the string is just a single line. - 1. Quotes are no longer escaped: ```diff @@ -44,7 +43,6 @@ There were also [changes](https://github.com/vitest-dev/vitest/pull/4076) to `@v - `client.setTest` was renamed to `client.startCurrentRun` - `client.resetCurrent` was renamed to `client.finishCurrentRun` - ### Pools are Standardized [#4172](https://github.com/vitest-dev/vitest/pull/4172) We removed a lot of configuration options to make it easier to configure the runner to your needs. Please, have a look at migration examples if you rely on `--threads` or other related flags. @@ -145,7 +143,6 @@ A few types were removed in favor of Jest-style "Mock" naming. `SpyInstance` is deprecated in favor of `MockInstance` and will be removed in the next major release. ::: - ### Timer mocks [#3925](https://github.com/vitest-dev/vitest/pull/3925) `vi.useFakeTimers()` no longer automatically mocks [`process.nextTick`](https://nodejs.org/api/process.html#processnexttickcallback-args). diff --git a/docs/guide/mocking.md b/docs/guide/mocking.md index 87c88e160..e40b9b108 100644 --- a/docs/guide/mocking.md +++ b/docs/guide/mocking.md @@ -362,7 +362,6 @@ Because Vitest runs in Node, mocking network requests is tricky; web APIs are no Mock Service Worker (MSW) works by intercepting the requests your tests make, allowing you to use it without changing any of your application code. In-browser, this uses the [Service Worker API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API). In Node.js, and for Vitest, it uses the [`@mswjs/interceptors`](https://github.com/mswjs/interceptors) library. To learn more about MSW, read their [introduction](https://mswjs.io/docs/) - ### Configuration You can use it like below in your [setup file](/config/#setupfiles) diff --git a/docs/guide/reporters.md b/docs/guide/reporters.md index 933602a80..699bec9d6 100644 --- a/docs/guide/reporters.md +++ b/docs/guide/reporters.md @@ -426,7 +426,6 @@ not ok 1 - __tests__/test-file-1.test.ts > first test file > 2 + 2 should equal ok 2 - __tests__/test-file-1.test.ts > first test file > 4 - 2 should equal 2 # time=0.00ms ``` - ### Hanging Process Reporter Displays a list of hanging processes, if any are preventing Vitest from exiting safely. The `hanging-process` reporter does not itself display test results, but can be used in conjunction with another reporter to monitor processes while tests run. Using this reporter can be resource-intensive, so should generally be reserved for debugging purposes in situations where Vitest consistently cannot exit the process. @@ -453,8 +452,6 @@ to provide annotations for test failures. This reporter is automatically enabled Github Actions Github Actions - - ## Custom Reporters You can use third-party custom reporters installed from NPM by specifying their package name in the reporters' option: diff --git a/docs/guide/snapshot.md b/docs/guide/snapshot.md index a91a10934..727ad8c99 100644 --- a/docs/guide/snapshot.md +++ b/docs/guide/snapshot.md @@ -159,7 +159,6 @@ export default { } satisfies SnapshotSerializer ``` - ```ts import { defineConfig } from 'vite' diff --git a/docs/guide/ui.md b/docs/guide/ui.md index 49c931190..6797091f9 100644 --- a/docs/guide/ui.md +++ b/docs/guide/ui.md @@ -18,7 +18,6 @@ vitest --ui Then you can visit the Vitest UI at `http://localhost:51204/__vitest__/` - Vitest UI Vitest UI diff --git a/eslint.config.js b/eslint.config.js index c23057a4b..0525bdb0b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -24,8 +24,14 @@ export default antfu( 'node/prefer-global/process': 'off', 'no-empty-pattern': 'off', 'antfu/indent-binary-ops': 'off', - 'style/member-delimiter-style': ['error', { multiline: { delimiter: 'none' }, singleline: { delimiter: 'semi' } }], 'unused-imports/no-unused-imports': 'error', + 'style/member-delimiter-style': [ + 'error', + { + multiline: { delimiter: 'none' }, + singleline: { delimiter: 'semi' }, + }, + ], 'ts/no-invalid-this': 'off', @@ -42,6 +48,12 @@ export default antfu( 'import/no-named-as-default': 'off', }, }, + { + files: [`packages/*/*.{js,mjs,d.ts}`], + rules: { + 'antfu/no-import-dist': 'off', + }, + }, { files: [`packages/${GLOB_SRC}`], rules: { diff --git a/examples/image-snapshot/test/basic.test.ts b/examples/image-snapshot/test/basic.test.ts index 537c8d1f7..54e35e293 100644 --- a/examples/image-snapshot/test/basic.test.ts +++ b/examples/image-snapshot/test/basic.test.ts @@ -4,7 +4,7 @@ import { toMatchImageSnapshot } from 'jest-image-snapshot' declare module 'vitest' { interface Assertion { - toMatchImageSnapshot(): T + toMatchImageSnapshot: () => T } } diff --git a/netlify.toml b/netlify.toml index 7a1c0873a..fcf540413 100755 --- a/netlify.toml +++ b/netlify.toml @@ -1,19 +1,20 @@ -[build.environment] - NODE_VERSION = "20" - # don't need playwright for docs build - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1" - [build] - publish = "docs/.vitepress/dist" - command = "pnpm docs:build" - ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- docs/ package.json pnpm-lock.yaml" +publish = "docs/.vitepress/dist" +command = "pnpm docs:build" +ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- docs/ package.json pnpm-lock.yaml" + +[build.environment] +NODE_VERSION = "20" +# don't need playwright for docs build +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1" [[redirects]] - from = "/new" - to = "https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/" - status = 302 +from = "/new" +to = "https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/" +status = 302 [[headers]] - for = "/manifest.webmanifest" - [headers.values] - Content-Type = "application/manifest+json" +for = "/manifest.webmanifest" + +[headers.values] +Content-Type = "application/manifest+json" diff --git a/package.json b/package.json index df4106b8e..baed07eca 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "test:browser:playwright": "pnpm -C test/browser run test:playwright" }, "devDependencies": { - "@antfu/eslint-config": "^1.2.1", + "@antfu/eslint-config": "^2.6.4", "@antfu/ni": "^0.21.12", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.0.1", diff --git a/packages/browser/package.json b/packages/browser/package.json index 478a9c545..efeba6c3c 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -55,13 +55,13 @@ "webdriverio": "*" }, "peerDependenciesMeta": { - "webdriverio": { + "playwright": { "optional": true }, "safaridriver": { "optional": true }, - "playwright": { + "webdriverio": { "optional": true } }, diff --git a/packages/browser/src/client/runner.ts b/packages/browser/src/client/runner.ts index 64259d1e8..63a9be827 100644 --- a/packages/browser/src/client/runner.ts +++ b/packages/browser/src/client/runner.ts @@ -1,4 +1,4 @@ -import type { File, TaskResultPack, Test, VitestRunner } from '@vitest/runner' +import type { File, Task, TaskResultPack, VitestRunner } from '@vitest/runner' import type { ResolvedConfig } from 'vitest' import type { VitestExecutor } from 'vitest/execute' import { rpc } from './rpc' @@ -16,10 +16,10 @@ interface CoverageHandler { } export function createBrowserRunner( - VitestRunner: { new(config: ResolvedConfig): VitestRunner }, + runnerClass: { new(config: ResolvedConfig): VitestRunner }, coverageModule: CoverageHandler | null, ): { new(options: BrowserRunnerOptions): VitestRunner } { - return class BrowserTestRunner extends VitestRunner { + return class BrowserTestRunner extends runnerClass implements VitestRunner { public config: ResolvedConfig hashMap = browserHashMap @@ -28,7 +28,7 @@ export function createBrowserRunner( this.config = options.config } - async onAfterRunTask(task: Test) { + onAfterRunTask = async (task: Task) => { await super.onAfterRunTask?.(task) if (this.config.bail && task.result?.state === 'fail') { @@ -42,7 +42,7 @@ export function createBrowserRunner( } } - async onAfterRunFiles(files: File[]) { + onAfterRunFiles = async (files: File[]) => { await super.onAfterRunFiles?.(files) const coverage = await coverageModule?.takeCoverage?.() @@ -55,15 +55,15 @@ export function createBrowserRunner( } } - onCollected(files: File[]): unknown { + onCollected = (files: File[]): unknown => { return rpc().onCollected(files) } - onTaskUpdate(task: TaskResultPack[]): Promise { + onTaskUpdate = (task: TaskResultPack[]): Promise => { return rpc().onTaskUpdate(task) } - async importFile(filepath: string) { + importFile = async (filepath: string) => { let [test, hash] = this.hashMap.get(filepath) ?? [false, ''] if (hash === '') { hash = Date.now().toString() diff --git a/packages/browser/src/client/utils.ts b/packages/browser/src/client/utils.ts index 69c7f0556..4880c2f2a 100644 --- a/packages/browser/src/client/utils.ts +++ b/packages/browser/src/client/utils.ts @@ -14,9 +14,9 @@ interface BrowserRunnerState { runningFiles: string[] moduleCache: WorkerGlobalState['moduleCache'] config: ResolvedConfig - exportAll(): void - wrapModule(module: any): any - runTests(tests: string[]): Promise + exportAll: () => void + wrapModule: (module: any) => any + runTests: (tests: string[]) => Promise } export function getBrowserState(): BrowserRunnerState { diff --git a/packages/coverage-istanbul/src/provider.ts b/packages/coverage-istanbul/src/provider.ts index f869bb4b5..e80029f51 100644 --- a/packages/coverage-istanbul/src/provider.ts +++ b/packages/coverage-istanbul/src/provider.ts @@ -32,8 +32,8 @@ interface TestExclude { excludeNodeModules?: boolean relativePath?: boolean }): { - shouldInstrument(filePath: string): boolean - glob(cwd: string): Promise + shouldInstrument: (filePath: string) => boolean + glob: (cwd: string) => Promise } } diff --git a/packages/coverage-v8/src/provider.ts b/packages/coverage-v8/src/provider.ts index e393ddc7a..18e225c43 100644 --- a/packages/coverage-v8/src/provider.ts +++ b/packages/coverage-v8/src/provider.ts @@ -35,8 +35,8 @@ interface TestExclude { excludeNodeModules?: boolean relativePath?: boolean }): { - shouldInstrument(filePath: string): boolean - glob(cwd: string): Promise + shouldInstrument: (filePath: string) => boolean + glob: (cwd: string) => Promise } } diff --git a/packages/expect/src/jest-asymmetric-matchers.ts b/packages/expect/src/jest-asymmetric-matchers.ts index 424311d01..76759c3b8 100644 --- a/packages/expect/src/jest-asymmetric-matchers.ts +++ b/packages/expect/src/jest-asymmetric-matchers.ts @@ -6,10 +6,10 @@ import { diff, getCustomEqualityTesters, getMatcherUtils, stringify } from './je import { equals, isA, iterableEquality, pluralize, subsetEquality } from './jest-utils' export interface AsymmetricMatcherInterface { - asymmetricMatch(other: unknown): boolean - toString(): string - getExpectedType?(): string - toAsymmetricMatcher?(): string + asymmetricMatch: (other: unknown) => boolean + toString: () => string + getExpectedType?: () => string + toAsymmetricMatcher?: () => string } export abstract class AsymmetricMatcher< diff --git a/packages/expect/src/types.ts b/packages/expect/src/types.ts index 44df32476..7b1ed307f 100644 --- a/packages/expect/src/types.ts +++ b/packages/expect/src/types.ts @@ -91,72 +91,72 @@ export type MatchersObject = Record(actual: T, message?: string): Assertion - unreachable(message?: string): never - soft(actual: T, message?: string): Assertion - extend(expects: MatchersObject): void - addEqualityTesters(testers: Array): void - assertions(expected: number): void - hasAssertions(): void - anything(): any - any(constructor: unknown): any - getState(): MatcherState - setState(state: Partial): void + unreachable: (message?: string) => never + soft: (actual: T, message?: string) => Assertion + extend: (expects: MatchersObject) => void + addEqualityTesters: (testers: Array) => void + assertions: (expected: number) => void + hasAssertions: () => void + anything: () => any + any: (constructor: unknown) => any + getState: () => MatcherState + setState: (state: Partial) => void not: AsymmetricMatchersContaining } export interface AsymmetricMatchersContaining { - stringContaining(expected: string): any - objectContaining(expected: T): any - arrayContaining(expected: Array): any - stringMatching(expected: string | RegExp): any - closeTo(expected: number, precision?: number): any + stringContaining: (expected: string) => any + objectContaining: (expected: T) => any + arrayContaining: (expected: Array) => any + stringMatching: (expected: string | RegExp) => any + closeTo: (expected: number, precision?: number) => any } export interface JestAssertion extends jest.Matchers { // Jest compact - toEqual(expected: E): void - toStrictEqual(expected: E): void - toBe(expected: E): void - toMatch(expected: string | RegExp): void - toMatchObject(expected: E): void - toContain(item: E): void - toContainEqual(item: E): void - toBeTruthy(): void - toBeFalsy(): void - toBeGreaterThan(num: number | bigint): void - toBeGreaterThanOrEqual(num: number | bigint): void - toBeLessThan(num: number | bigint): void - toBeLessThanOrEqual(num: number | bigint): void - toBeNaN(): void - toBeUndefined(): void - toBeNull(): void - toBeDefined(): void - toBeInstanceOf(expected: E): void - toBeCalledTimes(times: number): void - toHaveLength(length: number): void - toHaveProperty(property: string | (string | number)[], value?: E): void - toBeCloseTo(number: number, numDigits?: number): void - toHaveBeenCalledTimes(times: number): void - toHaveBeenCalled(): void - toBeCalled(): void - toHaveBeenCalledWith(...args: E): void - toBeCalledWith(...args: E): void - toHaveBeenNthCalledWith(n: number, ...args: E): void - nthCalledWith(nthCall: number, ...args: E): void - toHaveBeenLastCalledWith(...args: E): void - lastCalledWith(...args: E): void - toThrow(expected?: string | Constructable | RegExp | Error): void - toThrowError(expected?: string | Constructable | RegExp | Error): void - toReturn(): void - toHaveReturned(): void - toReturnTimes(times: number): void - toHaveReturnedTimes(times: number): void - toReturnWith(value: E): void - toHaveReturnedWith(value: E): void - toHaveLastReturnedWith(value: E): void - lastReturnedWith(value: E): void - toHaveNthReturnedWith(nthCall: number, value: E): void - nthReturnedWith(nthCall: number, value: E): void + toEqual: (expected: E) => void + toStrictEqual: (expected: E) => void + toBe: (expected: E) => void + toMatch: (expected: string | RegExp) => void + toMatchObject: (expected: E) => void + toContain: (item: E) => void + toContainEqual: (item: E) => void + toBeTruthy: () => void + toBeFalsy: () => void + toBeGreaterThan: (num: number | bigint) => void + toBeGreaterThanOrEqual: (num: number | bigint) => void + toBeLessThan: (num: number | bigint) => void + toBeLessThanOrEqual: (num: number | bigint) => void + toBeNaN: () => void + toBeUndefined: () => void + toBeNull: () => void + toBeDefined: () => void + toBeInstanceOf: (expected: E) => void + toBeCalledTimes: (times: number) => void + toHaveLength: (length: number) => void + toHaveProperty: (property: string | (string | number)[], value?: E) => void + toBeCloseTo: (number: number, numDigits?: number) => void + toHaveBeenCalledTimes: (times: number) => void + toHaveBeenCalled: () => void + toBeCalled: () => void + toHaveBeenCalledWith: (...args: E) => void + toBeCalledWith: (...args: E) => void + toHaveBeenNthCalledWith: (n: number, ...args: E) => void + nthCalledWith: (nthCall: number, ...args: E) => void + toHaveBeenLastCalledWith: (...args: E) => void + lastCalledWith: (...args: E) => void + toThrow: (expected?: string | Constructable | RegExp | Error) => void + toThrowError: (expected?: string | Constructable | RegExp | Error) => void + toReturn: () => void + toHaveReturned: () => void + toReturnTimes: (times: number) => void + toHaveReturnedTimes: (times: number) => void + toReturnWith: (value: E) => void + toHaveReturnedWith: (value: E) => void + toHaveLastReturnedWith: (value: E) => void + lastReturnedWith: (value: E) => void + toHaveNthReturnedWith: (nthCall: number, value: E) => void + nthReturnedWith: (nthCall: number, value: E) => void } type VitestAssertion = { @@ -176,9 +176,9 @@ type Promisify = { } export interface Assertion extends VitestAssertion, JestAssertion { - toBeTypeOf(expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined'): void - toHaveBeenCalledOnce(): void - toSatisfy(matcher: (value: E) => boolean, message?: string): void + toBeTypeOf: (expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined') => void + toHaveBeenCalledOnce: () => void + toSatisfy: (matcher: (value: E) => boolean, message?: string) => void resolves: Promisify> rejects: Promisify> diff --git a/packages/runner/src/types/runner.ts b/packages/runner/src/types/runner.ts index 0f6fe71e6..6822c4903 100644 --- a/packages/runner/src/types/runner.ts +++ b/packages/runner/src/types/runner.ts @@ -1,5 +1,16 @@ import type { DiffOptions } from '@vitest/utils/diff' -import type { Custom, ExtendedContext, File, SequenceHooks, SequenceSetupFiles, Suite, TaskContext, TaskPopulated, TaskResultPack, Test } from './tasks' +import type { + Custom, + ExtendedContext, + File, + SequenceHooks, + SequenceSetupFiles, + Suite, + Task, + TaskContext, + TaskResultPack, + Test, +} from './tasks' export interface VitestRunnerConfig { root: string @@ -31,75 +42,81 @@ export interface VitestRunnerConstructor { new(config: VitestRunnerConfig): VitestRunner } -export type CancelReason = 'keyboard-input' | 'test-failure' | string & Record +export type CancelReason = + | 'keyboard-input' + | 'test-failure' + | string & Record export interface VitestRunner { /** * First thing that's getting called before actually collecting and running tests. */ - onBeforeCollect?(paths: string[]): unknown + onBeforeCollect?: (paths: string[]) => unknown /** * Called after collecting tests and before "onBeforeRun". */ - onCollected?(files: File[]): unknown + onCollected?: (files: File[]) => unknown /** * Called when test runner should cancel next test runs. * Runner should listen for this method and mark tests and suites as skipped in * "onBeforeRunSuite" and "onBeforeRunTask" when called. */ - onCancel?(reason: CancelReason): unknown + onCancel?: (reason: CancelReason) => unknown /** * Called before running a single test. Doesn't have "result" yet. */ - onBeforeRunTask?(test: TaskPopulated): unknown + onBeforeRunTask?: (test: Task) => unknown /** * Called before actually running the test function. Already has "result" with "state" and "startTime". */ - onBeforeTryTask?(test: TaskPopulated, options: { retry: number; repeats: number }): unknown + onBeforeTryTask?: (test: Task, options: { retry: number; repeats: number }) => unknown /** * Called after result and state are set. */ - onAfterRunTask?(test: TaskPopulated): unknown + onAfterRunTask?: (test: Task) => unknown /** * Called right after running the test function. Doesn't have new state yet. Will not be called, if the test function throws. */ - onAfterTryTask?(test: TaskPopulated, options: { retry: number; repeats: number }): unknown + onAfterTryTask?: ( + test: Task, + options: { retry: number; repeats: number } + ) => unknown /** * Called before running a single suite. Doesn't have "result" yet. */ - onBeforeRunSuite?(suite: Suite): unknown + onBeforeRunSuite?: (suite: Suite) => unknown /** * Called after running a single suite. Has state and result. */ - onAfterRunSuite?(suite: Suite): unknown + onAfterRunSuite?: (suite: Suite) => unknown /** * If defined, will be called instead of usual Vitest suite partition and handling. * "before" and "after" hooks will not be ignored. */ - runSuite?(suite: Suite): Promise + runSuite?: (suite: Suite) => Promise /** * If defined, will be called instead of usual Vitest handling. Useful, if you have your custom test function. * "before" and "after" hooks will not be ignored. */ - runTask?(test: TaskPopulated): Promise + runTask?: (test: Task) => Promise /** * Called, when a task is updated. The same as "onTaskUpdate" in a reporter, but this is running in the same thread as tests. */ - onTaskUpdate?(task: TaskResultPack[]): Promise + onTaskUpdate?: (task: TaskResultPack[]) => Promise /** * Called before running all tests in collected paths. */ - onBeforeRunFiles?(files: File[]): unknown + onBeforeRunFiles?: (files: File[]) => unknown /** * Called right after running all tests in collected paths. */ - onAfterRunFiles?(files: File[]): unknown + onAfterRunFiles?: (files: File[]) => unknown /** * Called when new context for a test is defined. Useful, if you want to add custom properties to the context. * If you only want to define custom context, consider using "beforeAll" in "setupFiles" instead. @@ -108,11 +125,13 @@ export interface VitestRunner { * * @see https://vitest.dev/advanced/runner.html#your-task-function */ - extendTaskContext?(context: TaskContext): ExtendedContext + extendTaskContext?: ( + context: TaskContext + ) => ExtendedContext /** * Called, when files are imported. Can be called in two situations: when collecting tests and when importing setup files. */ - importFile(filepath: string, source: VitestRunnerImportSource): unknown + importFile: (filepath: string, source: VitestRunnerImportSource) => unknown /** * Publicly available configuration. */ diff --git a/packages/runner/src/types/tasks.ts b/packages/runner/src/types/tasks.ts index 199ff8dc8..57895ee11 100644 --- a/packages/runner/src/types/tasks.ts +++ b/packages/runner/src/types/tasks.ts @@ -193,19 +193,19 @@ export interface TestOptions { interface ExtendedAPI { each: TestEachFunction - skipIf(condition: any): ChainableTestAPI - runIf(condition: any): ChainableTestAPI + skipIf: (condition: any) => ChainableTestAPI + runIf: (condition: any) => ChainableTestAPI } export type CustomAPI = ChainableTestAPI & ExtendedAPI & { - extend = {}>(fixtures: Fixtures): CustomAPI<{ + extend: = {}>(fixtures: Fixtures) => CustomAPI<{ [K in keyof T | keyof ExtraContext]: K extends keyof T ? T[K] : K extends keyof ExtraContext ? ExtraContext[K] : never }> } export type TestAPI = ChainableTestAPI & ExtendedAPI & { - extend = {}>(fixtures: Fixtures): TestAPI<{ + extend: = {}>(fixtures: Fixtures) => TestAPI<{ [K in keyof T | keyof ExtraContext]: K extends keyof T ? T[K] : K extends keyof ExtraContext ? ExtraContext[K] : never }> @@ -236,8 +236,8 @@ type ChainableSuiteAPI = ChainableFunction< export type SuiteAPI = ChainableSuiteAPI & { each: SuiteEachFunction - skipIf(condition: any): ChainableSuiteAPI - runIf(condition: any): ChainableSuiteAPI + skipIf: (condition: any) => ChainableSuiteAPI + runIf: (condition: any) => ChainableSuiteAPI } export type HookListener = (...args: T) => Awaitable diff --git a/packages/snapshot/README.md b/packages/snapshot/README.md index a89d9fe59..4c4ecda22 100644 --- a/packages/snapshot/README.md +++ b/packages/snapshot/README.md @@ -76,4 +76,4 @@ manager.add(result) // and then read the summary console.log(manager.summary) -``` \ No newline at end of file +``` diff --git a/packages/snapshot/src/types/environment.ts b/packages/snapshot/src/types/environment.ts index 57776314f..ff79cc1db 100644 --- a/packages/snapshot/src/types/environment.ts +++ b/packages/snapshot/src/types/environment.ts @@ -1,11 +1,11 @@ export interface SnapshotEnvironment { - getVersion(): string - getHeader(): string - resolvePath(filepath: string): Promise - resolveRawPath(testPath: string, rawPath: string): Promise - saveSnapshotFile(filepath: string, snapshot: string): Promise - readSnapshotFile(filepath: string): Promise - removeSnapshotFile(filepath: string): Promise + getVersion: () => string + getHeader: () => string + resolvePath: (filepath: string) => Promise + resolveRawPath: (testPath: string, rawPath: string) => Promise + saveSnapshotFile: (filepath: string, snapshot: string) => Promise + readSnapshotFile: (filepath: string) => Promise + removeSnapshotFile: (filepath: string) => Promise } export interface SnapshotEnvironmentOptions { diff --git a/packages/spy/src/index.ts b/packages/spy/src/index.ts index 023b70957..6e3315b56 100644 --- a/packages/spy/src/index.ts +++ b/packages/spy/src/index.ts @@ -113,11 +113,11 @@ export interface MockInstance { /** * Use it to return the name given to mock with method `.mockName(name)`. */ - getMockName(): string + getMockName: () => string /** * Sets internal mock name. Useful to see the name of the mock if an assertion fails. */ - mockName(n: string): this + mockName: (n: string) => this /** * Current context of the mock. It stores information about all invocation calls, instances, and results. */ @@ -127,19 +127,19 @@ export interface MockInstance { * * It is useful if you need to clean up mock between different assertions. */ - mockClear(): this + mockClear: () => this /** * Does what `mockClear` does and makes inner implementation an empty function (returning `undefined` when invoked). This also resets all "once" implementations. * * This is useful when you want to completely reset a mock to the default state. */ - mockReset(): this + mockReset: () => this /** * Does what `mockReset` does and restores inner implementation to the original function. * * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`. */ - mockRestore(): void + mockRestore: () => void /** * Returns current mock implementation if there is one. * @@ -147,14 +147,14 @@ export interface MockInstance { * * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided. */ - getMockImplementation(): ((...args: TArgs) => TReturns) | undefined + getMockImplementation: () => ((...args: TArgs) => TReturns) | undefined /** * Accepts a function that will be used as an implementation of the mock. * @example * const increment = vi.fn().mockImplementation(count => count + 1); * expect(increment(3)).toBe(4); */ - mockImplementation(fn: ((...args: TArgs) => TReturns)): this + mockImplementation: (fn: ((...args: TArgs) => TReturns)) => this /** * Accepts a function that will be used as a mock implementation during the next call. Can be chained so that multiple function calls produce different results. * @example @@ -162,7 +162,7 @@ export interface MockInstance { * expect(fn(3)).toBe(4); * expect(fn(3)).toBe(3); */ - mockImplementationOnce(fn: ((...args: TArgs) => TReturns)): this + mockImplementationOnce: (fn: ((...args: TArgs) => TReturns)) => this /** * Overrides the original mock implementation temporarily while the callback is being executed. * @example @@ -174,15 +174,15 @@ export interface MockInstance { * * myMockFn() // 'original' */ - withImplementation(fn: ((...args: TArgs) => TReturns), cb: () => T): T extends Promise ? Promise : this + withImplementation: (fn: ((...args: TArgs) => TReturns), cb: () => T) => T extends Promise ? Promise : this /** * Use this if you need to return `this` context from the method without invoking actual implementation. */ - mockReturnThis(): this + mockReturnThis: () => this /** * Accepts a value that will be returned whenever the mock function is called. */ - mockReturnValue(obj: TReturns): this + mockReturnValue: (obj: TReturns) => this /** * Accepts a value that will be returned during the next function call. If chained, every consecutive call will return the specified value. * @@ -197,14 +197,14 @@ export interface MockInstance { * // 'first call', 'second call', 'default' * console.log(myMockFn(), myMockFn(), myMockFn()) */ - mockReturnValueOnce(obj: TReturns): this + mockReturnValueOnce: (obj: TReturns) => this /** * Accepts a value that will be resolved when async function is called. * @example * const asyncMock = vi.fn().mockResolvedValue(42) * asyncMock() // Promise<42> */ - mockResolvedValue(obj: Awaited): this + mockResolvedValue: (obj: Awaited) => this /** * Accepts a value that will be resolved during the next function call. If chained, every consecutive call will resolve specified value. * @example @@ -217,14 +217,14 @@ export interface MockInstance { * // Promise<'first call'>, Promise<'second call'>, Promise<'default'> * console.log(myMockFn(), myMockFn(), myMockFn()) */ - mockResolvedValueOnce(obj: Awaited): this + mockResolvedValueOnce: (obj: Awaited) => this /** * Accepts an error that will be rejected when async function is called. * @example * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error')) * await asyncMock() // throws 'Async error' */ - mockRejectedValue(obj: any): this + mockRejectedValue: (obj: any) => this /** * Accepts a value that will be rejected during the next function call. If chained, every consecutive call will reject specified value. * @example @@ -236,7 +236,7 @@ export interface MockInstance { * await asyncMock() // first call * await asyncMock() // throws "Async error" */ - mockRejectedValueOnce(obj: any): this + mockRejectedValueOnce: (obj: any) => this } export interface Mock extends MockInstance { diff --git a/packages/ui/cypress/support/mount.ts b/packages/ui/cypress/support/mount.ts index d1fd06678..13b220dab 100644 --- a/packages/ui/cypress/support/mount.ts +++ b/packages/ui/cypress/support/mount.ts @@ -28,7 +28,7 @@ declare global { /** * Install all vue plugins and globals then mount */ - mount(comp: Component, options?: unknown): Cypress.Chainable + mount: (comp: Component, options?: unknown) => Cypress.Chainable } } } diff --git a/packages/vite-node/src/hmr/emitter.ts b/packages/vite-node/src/hmr/emitter.ts index 924a8030d..06afe9862 100644 --- a/packages/vite-node/src/hmr/emitter.ts +++ b/packages/vite-node/src/hmr/emitter.ts @@ -4,10 +4,9 @@ import type { HMRPayload, Plugin } from 'vite' export type EventType = string | symbol export type Handler = (event: T) => void export interface Emitter> { - on(type: Key, handler: Handler): void - off(type: Key, handler?: Handler): void - emit(type: Key, event: Events[Key]): void - emit(type: undefined extends Events[Key] ? Key : never): void + on: (type: Key, handler: Handler) => void + off: (type: Key, handler?: Handler) => void + emit: ((type: Key, event: Events[Key]) => void) & ((type: undefined extends Events[Key] ? Key : never) => void) } export type HMREmitter = Emitter<{ @@ -22,7 +21,7 @@ declare module 'vite' { export function createHmrEmitter(): HMREmitter { const emitter = new EventEmitter() - return emitter + return emitter as HMREmitter } export function viteNodeHmrPlugin(): Plugin { diff --git a/packages/vite-node/src/source-map-handler.ts b/packages/vite-node/src/source-map-handler.ts index f71af8e83..383416906 100644 --- a/packages/vite-node/src/source-map-handler.ts +++ b/packages/vite-node/src/source-map-handler.ts @@ -225,7 +225,7 @@ function mapEvalOrigin(origin: string): string { } interface CallSite extends NodeJS.CallSite { - getScriptNameOrSourceURL(): string + getScriptNameOrSourceURL: () => string } // This is copied almost verbatim from the V8 source code at diff --git a/packages/vitest/package.json b/packages/vitest/package.json index 8abd6af8b..7b5550e66 100644 --- a/packages/vitest/package.json +++ b/packages/vitest/package.json @@ -121,22 +121,22 @@ "jsdom": "*" }, "peerDependenciesMeta": { - "@types/node": { + "@edge-runtime/vm": { "optional": true }, - "@vitest/ui": { + "@types/node": { "optional": true }, "@vitest/browser": { "optional": true }, - "happy-dom": { + "@vitest/ui": { "optional": true }, - "jsdom": { + "happy-dom": { "optional": true }, - "@edge-runtime/vm": { + "jsdom": { "optional": true } }, diff --git a/packages/vitest/src/api/types.ts b/packages/vitest/src/api/types.ts index 6dba431c2..333182a93 100644 --- a/packages/vitest/src/api/types.ts +++ b/packages/vitest/src/api/types.ts @@ -7,36 +7,36 @@ export interface TransformResultWithSource extends TransformResult { } export interface WebSocketHandlers { - onUnhandledError(error: unknown, type: string): Promise - onCollected(files?: File[]): Promise - onTaskUpdate(packs: TaskResultPack[]): void - onAfterSuiteRun(meta: AfterSuiteRunMeta): void - onCancel(reason: CancelReason): void - getCountOfFailedTests(): number - sendLog(log: UserConsoleLog): void - getFiles(): File[] - getPaths(): string[] - getConfig(): ResolvedConfig - resolveSnapshotPath(testPath: string): string - resolveSnapshotRawPath(testPath: string, rawPath: string): string - getModuleGraph(id: string): Promise - getTransformResult(id: string): Promise - readSnapshotFile(id: string): Promise - readTestFile(id: string): Promise - saveTestFile(id: string, content: string): Promise - saveSnapshotFile(id: string, content: string): Promise - removeSnapshotFile(id: string): Promise - snapshotSaved(snapshot: SnapshotResult): void - rerun(files: string[]): Promise - updateSnapshot(file?: File): Promise - getProvidedContext(): ProvidedContext - getUnhandledErrors(): unknown[] + onUnhandledError: (error: unknown, type: string) => Promise + onCollected: (files?: File[]) => Promise + onTaskUpdate: (packs: TaskResultPack[]) => void + onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void + onCancel: (reason: CancelReason) => void + getCountOfFailedTests: () => number + sendLog: (log: UserConsoleLog) => void + getFiles: () => File[] + getPaths: () => string[] + getConfig: () => ResolvedConfig + resolveSnapshotPath: (testPath: string) => string + resolveSnapshotRawPath: (testPath: string, rawPath: string) => string + getModuleGraph: (id: string) => Promise + getTransformResult: (id: string) => Promise + readSnapshotFile: (id: string) => Promise + readTestFile: (id: string) => Promise + saveTestFile: (id: string, content: string) => Promise + saveSnapshotFile: (id: string, content: string) => Promise + removeSnapshotFile: (id: string) => Promise + snapshotSaved: (snapshot: SnapshotResult) => void + rerun: (files: string[]) => Promise + updateSnapshot: (file?: File) => Promise + getProvidedContext: () => ProvidedContext + getUnhandledErrors: () => unknown[] - finishBrowserTests(): void - getBrowserFiles(): string[] - debug(...args: string[]): void + finishBrowserTests: () => void + getBrowserFiles: () => string[] + debug: (...args: string[]) => void } export interface WebSocketEvents extends Pick { - onCancel(reason: CancelReason): void + onCancel: (reason: CancelReason) => void } diff --git a/packages/vitest/src/integrations/vi.ts b/packages/vitest/src/integrations/vi.ts index 052db9b9f..72b438fa8 100644 --- a/packages/vitest/src/integrations/vi.ts +++ b/packages/vitest/src/integrations/vi.ts @@ -18,76 +18,76 @@ export interface VitestUtils { /** * Checks if fake timers are enabled. */ - isFakeTimers(): boolean + isFakeTimers: () => boolean /** * This method wraps all further calls to timers until [`vi.useRealTimers()`](https://vitest.dev/api/vi#vi-userealtimers) is called. */ - useFakeTimers(config?: FakeTimerInstallOpts): VitestUtils + useFakeTimers: (config?: FakeTimerInstallOpts) => VitestUtils /** * Restores mocked timers to their original implementations. All timers that were scheduled before will be discarded. */ - useRealTimers(): VitestUtils + useRealTimers: () => VitestUtils /** * This method will call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call. * It will not fire any timer that was initiated during its call. */ - runOnlyPendingTimers(): VitestUtils + runOnlyPendingTimers: () => VitestUtils /** * This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call, even asynchronous ones. * It will not fire any timer that was initiated during its call. */ - runOnlyPendingTimersAsync(): Promise + runOnlyPendingTimersAsync: () => Promise /** * This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired. * If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)). */ - runAllTimers(): VitestUtils + runAllTimers: () => VitestUtils /** * This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers. * If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)). */ - runAllTimersAsync(): Promise + runAllTimersAsync: () => Promise /** * Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves. */ - runAllTicks(): VitestUtils + runAllTicks: () => VitestUtils /** * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. */ - advanceTimersByTime(ms: number): VitestUtils + advanceTimersByTime: (ms: number) => VitestUtils /** * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. This will include and await asynchronously set timers. */ - advanceTimersByTimeAsync(ms: number): Promise + advanceTimersByTimeAsync: (ms: number) => Promise /** * Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself. */ - advanceTimersToNextTimer(): VitestUtils + advanceTimersToNextTimer: () => VitestUtils /** * Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call. */ - advanceTimersToNextTimerAsync(): Promise + advanceTimersToNextTimerAsync: () => Promise /** * Get the number of waiting timers. */ - getTimerCount(): number + getTimerCount: () => number /** * If fake timers are enabled, this method simulates a user changing the system clock (will affect date related API like `hrtime`, `performance.now` or `new Date()`) - however, it will not fire any timers. * If fake timers are not enabled, this method will only mock `Date.*` and `new Date()` calls. */ - setSystemTime(time: number | string | Date): VitestUtils + setSystemTime: (time: number | string | Date) => VitestUtils /** * Returns mocked current date that was set using `setSystemTime`. If date is not mocked the method will return `null`. */ - getMockedSystemTime(): Date | null + getMockedSystemTime: () => Date | null /** * When using `vi.useFakeTimers`, `Date.now` calls are mocked. If you need to get real time in milliseconds, you can call this function. */ - getRealSystemTime(): number + getRealSystemTime: () => number /** * Removes all timers that are scheduled to run. These timers will never run in the future. */ - clearAllTimers(): VitestUtils + clearAllTimers: () => VitestUtils /** * Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock). @@ -172,7 +172,7 @@ export interface VitestUtils { * * If used with [`vi.mock`](https://vitest.dev/api/vi#vi-mock), both will be hoisted in the order they are defined in. */ - hoisted(factory: () => T): T + hoisted: (factory: () => T) => T /** * Mocks every import call to the module even if it was already statically imported. @@ -184,7 +184,7 @@ export interface VitestUtils { * @param path Path to the module. Can be aliased, if your Vitest config supports it * @param factory Mocked module factory. The result of this function will be an exports object */ - mock(path: string, factory?: MockFactoryWithHelper): void + mock: (path: string, factory?: MockFactoryWithHelper) => void /** * Removes module from mocked registry. All calls to import will return the original module even if it was mocked before. @@ -192,7 +192,7 @@ export interface VitestUtils { * This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example. * @param path Path to the module. Can be aliased, if your Vitest config supports it */ - unmock(path: string): void + unmock: (path: string) => void /** * Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call. @@ -203,14 +203,14 @@ export interface VitestUtils { * @param path Path to the module. Can be aliased, if your Vitest config supports it * @param factory Mocked module factory. The result of this function will be an exports object */ - doMock(path: string, factory?: MockFactoryWithHelper): void + doMock: (path: string, factory?: MockFactoryWithHelper) => void /** * Removes module from mocked registry. All subsequent calls to import will return original module. * * Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file. * @param path Path to the module. Can be aliased, if your Vitest config supports it */ - doUnmock(path: string): void + doUnmock: (path: string) => void /** * Imports module, bypassing all checks if it should be mocked. @@ -223,7 +223,7 @@ export interface VitestUtils { * }) * @param path Path to the module. Can be aliased, if your config supports it */ - importActual(path: string): Promise + importActual: (path: string) => Promise /** * Imports a module with all of its properties and nested properties mocked. @@ -236,7 +236,7 @@ export interface VitestUtils { * @param path Path to the module. Can be aliased, if your config supports it * @returns Fully mocked module */ - importMock(path: string): Promise> + importMock: (path: string) => Promise> /** * Type helper for TypeScript. Just returns the object that was passed. @@ -255,60 +255,54 @@ export interface VitestUtils { * @param deep If the object is deeply mocked * @param options If the object is partially or deeply mocked */ - mocked(item: T, deep?: false): MaybeMocked - mocked(item: T, deep: true): MaybeMockedDeep - mocked(item: T, options: { partial?: false; deep?: false }): MaybeMocked - mocked(item: T, options: { partial?: false; deep: true }): MaybeMockedDeep - mocked(item: T, options: { partial: true; deep?: false }): MaybePartiallyMocked - mocked(item: T, options: { partial: true; deep: true }): MaybePartiallyMockedDeep - mocked(item: T): MaybeMocked + mocked: ((item: T, deep?: false) => MaybeMocked) & ((item: T, deep: true) => MaybeMockedDeep) & ((item: T, options: { partial?: false; deep?: false }) => MaybeMocked) & ((item: T, options: { partial?: false; deep: true }) => MaybeMockedDeep) & ((item: T, options: { partial: true; deep?: false }) => MaybePartiallyMocked) & ((item: T, options: { partial: true; deep: true }) => MaybePartiallyMockedDeep) & ((item: T) => MaybeMocked) /** * Checks that a given parameter is a mock function. If you are using TypeScript, it will also narrow down its type. */ - isMockFunction(fn: any): fn is MockInstance + isMockFunction: (fn: any) => fn is MockInstance /** * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation. * * It is useful if you need to clean up mock between different assertions. */ - clearAllMocks(): VitestUtils + clearAllMocks: () => VitestUtils /** * Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will empty `.mock` state, reset "once" implementations and force the base implementation to return `undefined` when invoked. * * This is useful when you want to completely reset a mock to the default state. */ - resetAllMocks(): VitestUtils + resetAllMocks: () => VitestUtils /** * Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This will restore all original implementations. */ - restoreAllMocks(): VitestUtils + restoreAllMocks: () => VitestUtils /** * Makes value available on global namespace. * Useful, if you want to have global variables available, like `IntersectionObserver`. * You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option. */ - stubGlobal(name: string | symbol | number, value: unknown): VitestUtils + stubGlobal: (name: string | symbol | number, value: unknown) => VitestUtils /** * Changes the value of `import.meta.env` and `process.env`. * You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option. */ - stubEnv(name: string, value: string): VitestUtils + stubEnv: (name: string, value: string) => VitestUtils /** * Reset the value to original value that was available before first `vi.stubGlobal` was called. */ - unstubAllGlobals(): VitestUtils + unstubAllGlobals: () => VitestUtils /** * Reset environmental variables to the ones that were available before first `vi.stubEnv` was called. */ - unstubAllEnvs(): VitestUtils + unstubAllEnvs: () => VitestUtils /** * Resets modules registry by clearing the cache of all modules. This allows modules to be reevaluated when reimported. @@ -316,24 +310,24 @@ export interface VitestUtils { * * This method does not reset mocks registry. To clear mocks registry, use [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock) or [`vi.doUnmock`](https://vitest.dev/api/vi#vi-dounmock). */ - resetModules(): VitestUtils + resetModules: () => VitestUtils /** * Wait for all imports to load. Useful, if you have a synchronous call that starts * importing a module that you cannot await otherwise. * Will also wait for new imports, started during the wait. */ - dynamicImportSettled(): Promise + dynamicImportSettled: () => Promise /** * Updates runtime config. You can only change values that are used when executing tests. */ - setConfig(config: RuntimeConfig): void + setConfig: (config: RuntimeConfig) => void /** * If config was changed with `vi.setConfig`, this will reset it to the original state. */ - resetConfig(): void + resetConfig: () => void } function createVitest(): VitestUtils { @@ -518,8 +512,9 @@ function createVitest(): VitestUtils { return _mocker.importMock(path, getImporter()) }, - mocked(item: T, _options = {}): MaybeMocked { - return item as any + // this is typed in the interface so it's not necessary to type it here + mocked(item: T, _options = {}): any { + return item }, isMockFunction(fn: any): fn is MockInstance { diff --git a/packages/vitest/src/node/globalSetup.ts b/packages/vitest/src/node/globalSetup.ts index 04d5b0d3e..7680b8056 100644 --- a/packages/vitest/src/node/globalSetup.ts +++ b/packages/vitest/src/node/globalSetup.ts @@ -5,7 +5,7 @@ import type { ResolvedConfig } from '../types/config' export interface GlobalSetupContext { config: ResolvedConfig - provide(key: T, value: ProvidedContext[T]): void + provide: (key: T, value: ProvidedContext[T]) => void } export interface GlobalSetupFile { diff --git a/packages/vitest/src/node/sequencers/types.ts b/packages/vitest/src/node/sequencers/types.ts index 12cf43ef4..fd5237f35 100644 --- a/packages/vitest/src/node/sequencers/types.ts +++ b/packages/vitest/src/node/sequencers/types.ts @@ -7,8 +7,8 @@ export interface TestSequencer { * Slicing tests into shards. Will be run before `sort`. * Only run, if `shard` is defined. */ - shard(files: WorkspaceSpec[]): Awaitable - sort(files: WorkspaceSpec[]): Awaitable + shard: (files: WorkspaceSpec[]) => Awaitable + sort: (files: WorkspaceSpec[]) => Awaitable } export interface TestSequencerConstructor { diff --git a/packages/vitest/src/node/workspace.ts b/packages/vitest/src/node/workspace.ts index 8e708b5e7..b99d88fc1 100644 --- a/packages/vitest/src/node/workspace.ts +++ b/packages/vitest/src/node/workspace.ts @@ -72,8 +72,8 @@ export class WorkspaceProject { browserState: { files: string[] - resolve(): void - reject(v: unknown): void + resolve: () => void + reject: (v: unknown) => void } | undefined testFilesList: string[] | null = null diff --git a/packages/vitest/src/runtime/runners/test.ts b/packages/vitest/src/runtime/runners/test.ts index 2d0786bab..c79231941 100644 --- a/packages/vitest/src/runtime/runners/test.ts +++ b/packages/vitest/src/runtime/runners/test.ts @@ -1,4 +1,4 @@ -import type { CancelReason, Custom, ExtendedContext, Suite, TaskContext, Test, VitestRunner, VitestRunnerImportSource } from '@vitest/runner' +import type { CancelReason, Custom, ExtendedContext, Suite, Task, TaskContext, Test, VitestRunner, VitestRunnerImportSource } from '@vitest/runner' import type { ExpectStatic } from '@vitest/expect' import { GLOBAL_EXPECT, getState, setState } from '@vitest/expect' import { getSnapshotClient } from '../../integrations/snapshot/chai' @@ -46,7 +46,7 @@ export class VitestTestRunner implements VitestRunner { } } - onAfterRunTask(test: Test) { + onAfterRunTask(test: Task) { this.snapshotClient.clearTest() if (this.config.logHeapUsage && typeof process !== 'undefined') @@ -59,7 +59,7 @@ export class VitestTestRunner implements VitestRunner { this.cancelRun = true } - async onBeforeRunTask(test: Test) { + async onBeforeRunTask(test: Task) { if (this.cancelRun) test.mode = 'skip' @@ -83,28 +83,28 @@ export class VitestTestRunner implements VitestRunner { } } - onBeforeTryTask(test: Test) { + onBeforeTryTask(test: Task) { setState({ assertionCalls: 0, isExpectingAssertions: false, isExpectingAssertionsError: null, expectedAssertionsNumber: null, expectedAssertionsNumberErrorGen: null, - testPath: test.suite.file?.filepath, + testPath: test.suite?.file?.filepath, currentTestName: getFullName(test), snapshotState: this.snapshotClient.snapshotState, }, (globalThis as any)[GLOBAL_EXPECT]) } - onAfterTryTask(test: Test) { + onAfterTryTask(test: Task) { const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError, - // @ts-expect-error local is untyped - } = test.context._local + // @ts-expect-error _local is untyped + } = 'context' in test && test.context._local ? test.context.expect.getState() : getState((globalThis as any)[GLOBAL_EXPECT]) if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber) diff --git a/packages/vitest/src/runtime/vm/commonjs-executor.ts b/packages/vitest/src/runtime/vm/commonjs-executor.ts index 964d6b659..58fbb0023 100644 --- a/packages/vitest/src/runtime/vm/commonjs-executor.ts +++ b/packages/vitest/src/runtime/vm/commonjs-executor.ts @@ -14,7 +14,7 @@ interface CommonjsExecutorOptions { const _require = createRequire(import.meta.url) interface PrivateNodeModule extends NodeModule { - _compile(code: string, filename: string): void + _compile: (code: string, filename: string) => void } const requiresCache = new WeakMap() diff --git a/packages/vitest/src/runtime/workers/threads.ts b/packages/vitest/src/runtime/workers/threads.ts index 20444b43e..38fb1a5ab 100644 --- a/packages/vitest/src/runtime/workers/threads.ts +++ b/packages/vitest/src/runtime/workers/threads.ts @@ -1,11 +1,12 @@ +import type { ContextRPC } from '../../types/rpc' import type { WorkerContext, WorkerGlobalState } from '../../types/worker' import { runBaseTests } from './base' import type { VitestWorker } from './types' import { createThreadsRpcOptions } from './utils' class ThreadsBaseWorker implements VitestWorker { - getRpcOptions(ctx: WorkerContext) { - return createThreadsRpcOptions(ctx) + getRpcOptions(ctx: ContextRPC) { + return createThreadsRpcOptions(ctx as WorkerContext) } runTests(state: WorkerGlobalState): unknown { diff --git a/packages/vitest/src/runtime/workers/types.ts b/packages/vitest/src/runtime/workers/types.ts index d55fca395..9c2a2d2aa 100644 --- a/packages/vitest/src/runtime/workers/types.ts +++ b/packages/vitest/src/runtime/workers/types.ts @@ -6,6 +6,6 @@ import type { WorkerGlobalState } from '../../types/worker' export type WorkerRpcOptions = Pick, 'on' | 'post' | 'serialize' | 'deserialize'> export interface VitestWorker { - getRpcOptions(ctx: ContextRPC): WorkerRpcOptions - runTests(state: WorkerGlobalState): Awaitable + getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions + runTests: (state: WorkerGlobalState) => Awaitable } diff --git a/packages/vitest/src/runtime/workers/vmThreads.ts b/packages/vitest/src/runtime/workers/vmThreads.ts index 4b131fb49..8040b8dfc 100644 --- a/packages/vitest/src/runtime/workers/vmThreads.ts +++ b/packages/vitest/src/runtime/workers/vmThreads.ts @@ -1,11 +1,12 @@ +import type { ContextRPC } from '../../types/rpc' import type { WorkerContext, WorkerGlobalState } from '../../types/worker' import type { VitestWorker, WorkerRpcOptions } from './types' import { createThreadsRpcOptions } from './utils' import { runVmTests } from './vm' class ThreadsVmWorker implements VitestWorker { - getRpcOptions(ctx: WorkerContext): WorkerRpcOptions { - return createThreadsRpcOptions(ctx) + getRpcOptions(ctx: ContextRPC): WorkerRpcOptions { + return createThreadsRpcOptions(ctx as WorkerContext) } runTests(state: WorkerGlobalState): unknown { diff --git a/packages/vitest/src/types/benchmark.ts b/packages/vitest/src/types/benchmark.ts index b869624d8..ad9c6f2c8 100644 --- a/packages/vitest/src/types/benchmark.ts +++ b/packages/vitest/src/types/benchmark.ts @@ -58,8 +58,8 @@ type ChainableBenchmarkAPI = ChainableFunction< void > export type BenchmarkAPI = ChainableBenchmarkAPI & { - skipIf(condition: any): ChainableBenchmarkAPI - runIf(condition: any): ChainableBenchmarkAPI + skipIf: (condition: any) => ChainableBenchmarkAPI + runIf: (condition: any) => ChainableBenchmarkAPI } export { diff --git a/packages/vitest/src/types/browser.ts b/packages/vitest/src/types/browser.ts index d01ad2d80..55c6d89b2 100644 --- a/packages/vitest/src/types/browser.ts +++ b/packages/vitest/src/types/browser.ts @@ -9,10 +9,14 @@ export interface BrowserProviderInitializationOptions { export interface BrowserProvider { name: string - getSupportedBrowsers(): readonly string[] - initialize(ctx: WorkspaceProject, options: BrowserProviderInitializationOptions): Awaitable - openPage(url: string): Awaitable - close(): Awaitable + getSupportedBrowsers: () => readonly string[] + openPage: (url: string) => Awaitable + close: () => Awaitable + // eslint-disable-next-line ts/method-signature-style -- we want to allow extended options + initialize( + ctx: WorkspaceProject, + options: BrowserProviderInitializationOptions + ): Awaitable } export interface BrowserProviderModule { diff --git a/packages/vitest/src/types/coverage.ts b/packages/vitest/src/types/coverage.ts index e7a9e1a42..4d10f51ff 100644 --- a/packages/vitest/src/types/coverage.ts +++ b/packages/vitest/src/types/coverage.ts @@ -8,21 +8,21 @@ type TransformResult = string | Partial | undefined | null export interface CoverageProvider { name: string - initialize(ctx: Vitest): Promise | void + initialize: (ctx: Vitest) => Promise | void - resolveOptions(): ResolvedCoverageOptions - clean(clean?: boolean): void | Promise + resolveOptions: () => ResolvedCoverageOptions + clean: (clean?: boolean) => void | Promise - onAfterSuiteRun(meta: AfterSuiteRunMeta): void | Promise + onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise - reportCoverage(reportContext?: ReportContext): void | Promise + reportCoverage: (reportContext?: ReportContext) => void | Promise - onFileTransform?( + onFileTransform?: ( sourceCode: string, id: string, // TODO: when upgrading vite, import Rollup from vite pluginCtx: any - ): TransformResult | Promise + ) => TransformResult | Promise } export interface ReportContext { @@ -34,22 +34,22 @@ export interface CoverageProviderModule { /** * Factory for creating a new coverage provider */ - getProvider(): CoverageProvider | Promise + getProvider: () => CoverageProvider | Promise /** * Executed before tests are run in the worker thread. */ - startCoverage?(): unknown | Promise + startCoverage?: () => unknown | Promise /** * Executed on after each run in the worker thread. Possible to return a payload passed to the provider */ - takeCoverage?(): unknown | Promise + takeCoverage?: () => unknown | Promise /** * Executed after all tests have been run in the worker thread. */ - stopCoverage?(): unknown | Promise + stopCoverage?: () => unknown | Promise } export type CoverageReporter = keyof ReportOptions | (string & {}) diff --git a/packages/vitest/src/types/general.ts b/packages/vitest/src/types/general.ts index dd62a7d18..3a8bf3736 100644 --- a/packages/vitest/src/types/general.ts +++ b/packages/vitest/src/types/general.ts @@ -18,19 +18,19 @@ export interface ModuleCache { } export interface EnvironmentReturn { - teardown(global: any): Awaitable + teardown: (global: any) => Awaitable } export interface VmEnvironmentReturn { - getVmContext(): { [key: string]: any } - teardown(): Awaitable + getVmContext: () => { [key: string]: any } + teardown: () => Awaitable } export interface Environment { name: string transformMode: 'web' | 'ssr' - setupVM?(options: Record): Awaitable - setup(global: any, options: Record): Awaitable + setupVM?: (options: Record) => Awaitable + setup: (global: any, options: Record) => Awaitable } export interface UserConsoleLog { diff --git a/packages/vitest/src/types/global.ts b/packages/vitest/src/types/global.ts index 66ea57a06..66f3b6e26 100644 --- a/packages/vitest/src/types/global.ts +++ b/packages/vitest/src/types/global.ts @@ -9,14 +9,24 @@ declare global { // eslint-disable-next-line ts/no-namespace namespace Chai { interface Assertion { - containSubset(expected: any): Assertion + containSubset: (expected: any) => Assertion } interface Assert { - containSubset(val: any, exp: any, msg?: string): void + containSubset: (val: any, exp: any, msg?: string) => void } } } +interface SnapshotMatcher { + (snapshot: Partial, message?: string): void + (message?: string): void +} + +interface InlineSnapshotMatcher { + (properties: Partial, snapshot?: string, message?: string): void + (message?: string): void +} + declare module '@vitest/expect' { interface MatcherState { environment: VitestEnvironment @@ -24,20 +34,17 @@ declare module '@vitest/expect' { } interface ExpectStatic { - addSnapshotSerializer(plugin: PrettyFormatPlugin): void + addSnapshotSerializer: (plugin: PrettyFormatPlugin) => void } interface Assertion { // Snapshots are extended in @vitest/snapshot and are not part of @vitest/expect - matchSnapshot(snapshot: Partial, message?: string): void - matchSnapshot(message?: string): void - toMatchSnapshot(snapshot: Partial, message?: string): void - toMatchSnapshot(message?: string): void - toMatchInlineSnapshot(properties: Partial, snapshot?: string, message?: string): void - toMatchInlineSnapshot(snapshot?: string, message?: string): void - toThrowErrorMatchingSnapshot(message?: string): void - toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void - toMatchFileSnapshot(filepath: string, message?: string): Promise + matchSnapshot: SnapshotMatcher + toMatchSnapshot: SnapshotMatcher + toMatchInlineSnapshot: InlineSnapshotMatcher + toThrowErrorMatchingSnapshot: (message?: string) => void + toThrowErrorMatchingInlineSnapshot: (snapshot?: string, message?: string) => void + toMatchFileSnapshot: (filepath: string, message?: string) => Promise } } diff --git a/packages/vitest/src/types/reporter.ts b/packages/vitest/src/types/reporter.ts index 07e65804c..5c696b92b 100644 --- a/packages/vitest/src/types/reporter.ts +++ b/packages/vitest/src/types/reporter.ts @@ -3,7 +3,7 @@ import type { Awaitable, UserConsoleLog } from './general' import type { File, TaskResultPack } from './tasks' export interface Reporter { - onInit?(ctx: Vitest): void + onInit?: (ctx: Vitest) => void onPathsCollected?: (paths?: string[]) => Awaitable onCollected?: (files?: File[]) => Awaitable onFinished?: (files?: File[], errors?: unknown[]) => Awaitable diff --git a/packages/vitest/src/types/worker.ts b/packages/vitest/src/types/worker.ts index 3b5e76e83..37ceccd6b 100644 --- a/packages/vitest/src/types/worker.ts +++ b/packages/vitest/src/types/worker.ts @@ -1,5 +1,5 @@ import type { MessagePort } from 'node:worker_threads' -import type { CancelReason, Test } from '@vitest/runner' +import type { CancelReason, Task } from '@vitest/runner' import type { ModuleCacheMap, ViteNodeResolveId } from 'vite-node' import type { BirpcReturn } from 'birpc' import type { MockMap } from './mocker' @@ -25,7 +25,7 @@ export interface WorkerGlobalState { ctx: ContextRPC config: ResolvedConfig rpc: WorkerRPC - current?: Test + current?: Task filepath?: string environment: Environment environmentTeardownRun?: boolean diff --git a/packages/vitest/src/utils/coverage.ts b/packages/vitest/src/utils/coverage.ts index f7be49a7a..e2c5ee263 100644 --- a/packages/vitest/src/utils/coverage.ts +++ b/packages/vitest/src/utils/coverage.ts @@ -21,7 +21,7 @@ export class BaseCoverageProvider { updateThresholds({ thresholds: allThresholds, perFile, configurationFile }: { thresholds: ResolvedThreshold[] perFile?: boolean - configurationFile: { read(): unknown; write(): void } + configurationFile: { read: () => unknown; write: () => void } }) { let updatedThresholds = false diff --git a/packages/ws-client/src/index.ts b/packages/ws-client/src/index.ts index 85e7e0b38..0118c8755 100644 --- a/packages/ws-client/src/index.ts +++ b/packages/ws-client/src/index.ts @@ -24,8 +24,8 @@ export interface VitestClient { ws: WebSocket state: StateManager rpc: BirpcReturn - waitForConnection(): Promise - reconnect(): Promise + waitForConnection: () => Promise + reconnect: () => Promise } export function createClient(url: string, options: VitestClientOptions = {}) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5272650d9..f27593c98 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,8 +25,8 @@ importers: .: devDependencies: '@antfu/eslint-config': - specifier: ^1.2.1 - version: 1.2.1(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest) + specifier: ^2.6.4 + version: 2.6.4(@vue/compiler-sfc@3.4.5)(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest) '@antfu/ni': specifier: ^0.21.12 version: 0.21.12 @@ -1231,7 +1231,7 @@ importers: version: 5.0.12(@types/node@20.11.5)(less@4.1.3) vite-plugin-pages: specifier: ^0.31.0 - version: 0.31.0(vite@5.0.12) + version: 0.31.0(@vue/compiler-sfc@3.4.5)(vite@5.0.12) vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.2.2) @@ -2251,52 +2251,78 @@ packages: '@jridgewell/gen-mapping': 0.3.2 '@jridgewell/trace-mapping': 0.3.18 - /@antfu/eslint-config@1.2.1(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest): - resolution: {integrity: sha512-/B7jSc9RARxGNZUoxkB2EL7pL7v5ubt25Ah3QbQaCalcIOC3YF+60mL4/G8Oi9Rtdng7ytNGg3bi50voKfqINQ==} + /@antfu/eslint-config@2.6.4(@vue/compiler-sfc@3.4.5)(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest): + resolution: {integrity: sha512-dMD/QC5KWS1OltdpKLhfZM7W7y7zils85opk8d4lyNr7yn0OFjZs7eMYtcC6DrrN2kQ1JrFvBM7uB0QdWn5PUQ==} hasBin: true peerDependencies: - eslint: '>=8.0.0' + '@unocss/eslint-plugin': '>=0.50.0' + eslint: '>=8.40.0' + eslint-plugin-format: '>=0.1.0' + eslint-plugin-react: ^7.33.2 + eslint-plugin-react-hooks: ^4.6.0 + eslint-plugin-react-refresh: ^0.4.4 + eslint-plugin-svelte: ^2.34.1 + svelte-eslint-parser: ^0.33.1 + peerDependenciesMeta: + '@unocss/eslint-plugin': + optional: true + eslint-plugin-format: + optional: true + eslint-plugin-react: + optional: true + eslint-plugin-react-hooks: + optional: true + eslint-plugin-react-refresh: + optional: true + eslint-plugin-svelte: + optional: true + svelte-eslint-parser: + optional: true dependencies: '@antfu/eslint-define-config': 1.23.0-2 + '@antfu/install-pkg': 0.3.1 '@eslint-types/jsdoc': 46.8.2-1 '@eslint-types/typescript-eslint': 6.19.1 - '@eslint-types/unicorn': 49.0.0 + '@eslint-types/unicorn': 50.0.1 '@stylistic/eslint-plugin': 1.6.0(eslint@8.54.0)(typescript@5.2.2) '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.54.0)(typescript@5.2.2) '@typescript-eslint/parser': 6.21.0(eslint@8.54.0)(typescript@5.2.2) eslint: 8.54.0 - eslint-config-flat-gitignore: 0.1.1 - eslint-plugin-antfu: 1.0.13(eslint@8.54.0) + eslint-config-flat-gitignore: 0.1.2 + eslint-merge-processors: 0.1.0(eslint@8.54.0) + eslint-plugin-antfu: 2.1.2(eslint@8.54.0) eslint-plugin-eslint-comments: 3.2.0(eslint@8.54.0) - eslint-plugin-i: 2.29.0(@typescript-eslint/parser@6.21.0)(eslint@8.54.0) - eslint-plugin-jsdoc: 46.9.0(eslint@8.54.0) - eslint-plugin-jsonc: 2.10.0(eslint@8.54.0) + eslint-plugin-i: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.54.0) + eslint-plugin-jsdoc: 48.0.6(eslint@8.54.0) + eslint-plugin-jsonc: 2.13.0(eslint@8.54.0) eslint-plugin-markdown: 3.0.1(eslint@8.54.0) - eslint-plugin-n: 16.3.1(eslint@8.54.0) + eslint-plugin-n: 16.6.2(eslint@8.54.0) eslint-plugin-no-only-tests: 3.1.0 - eslint-plugin-perfectionist: 2.5.0(eslint@8.54.0)(typescript@5.2.2)(vue-eslint-parser@9.3.2) - eslint-plugin-unicorn: 49.0.0(eslint@8.54.0) + eslint-plugin-perfectionist: 2.5.0(eslint@8.54.0)(typescript@5.2.2)(vue-eslint-parser@9.4.2) + eslint-plugin-toml: 0.9.2(eslint@8.54.0) + eslint-plugin-unicorn: 50.0.1(eslint@8.54.0) eslint-plugin-unused-imports: 3.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.54.0) - eslint-plugin-vitest: 0.3.9(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest) - eslint-plugin-vue: 9.18.1(eslint@8.54.0) - eslint-plugin-yml: 1.10.0(eslint@8.54.0) - execa: 8.0.1 - globals: 13.23.0 + eslint-plugin-vitest: 0.3.22(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest) + eslint-plugin-vue: 9.21.1(eslint@8.54.0) + eslint-plugin-yml: 1.12.2(eslint@8.54.0) + eslint-processor-vue-blocks: 0.1.1(@vue/compiler-sfc@3.4.5)(eslint@8.54.0) + globals: 13.24.0 jsonc-eslint-parser: 2.4.0 local-pkg: 0.5.0 parse-gitignore: 2.0.0 picocolors: 1.0.0 prompts: 2.4.2 - vue-eslint-parser: 9.3.2(eslint@8.54.0) + toml-eslint-parser: 0.9.3 + vue-eslint-parser: 9.4.2(eslint@8.54.0) yaml-eslint-parser: 1.2.2 yargs: 17.7.2 transitivePeerDependencies: + - '@vue/compiler-sfc' - astro-eslint-parser - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - svelte - - svelte-eslint-parser - typescript - vitest dev: true @@ -5054,8 +5080,8 @@ packages: resolution: {integrity: sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==} dev: false - /@es-joy/jsdoccomment@0.41.0: - resolution: {integrity: sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==} + /@es-joy/jsdoccomment@0.42.0: + resolution: {integrity: sha512-R1w57YlVA6+YE01wch3GPYn6bCsrOV3YW/5oGGE2tmX6JcL9Nr+b5IikrjMPF+v9CV3ay+obImEdsDhovhJrzw==} engines: {node: '>=16'} dependencies: comment-parser: 1.4.1 @@ -5507,8 +5533,8 @@ packages: resolution: {integrity: sha512-X0farz1+psE6Qfx6+ISQQ/J3ZetKlUeuTIN9Zt/agx4UXrgK6daH/n9ba776JxysK6YJCRaEHng/bcQQUm+BsA==} dev: true - /@eslint-types/unicorn@49.0.0: - resolution: {integrity: sha512-NfXSZIsPFRD2fwTDZQj8SaXqS/rXjB5foxMraLovyrYGXiQK2y0780drDKYYSVbqvco29QIYoZNmnKTUkzZMvQ==} + /@eslint-types/unicorn@50.0.1: + resolution: {integrity: sha512-nuJuipTNcg9f+oxZ+3QZw4tuDLmir4RJOPfM/oujgToiy1s+tePDZhwg5jUGc3q8OzTtPbVpsFSYX7QApjO3EA==} dev: true /@eslint/eslintrc@1.4.1: @@ -5545,6 +5571,23 @@ packages: - supports-color dev: true + /@eslint/eslintrc@2.1.4: + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + ajv: 6.12.6 + debug: 4.3.4(supports-color@8.1.1) + espree: 9.6.1 + globals: 13.24.0 + ignore: 5.2.4 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + dev: true + /@eslint/js@8.54.0: resolution: {integrity: sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -9750,14 +9793,6 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@6.10.0: - resolution: {integrity: sha512-TN/plV7dzqqC2iPNf1KrxozDgZs53Gfgg5ZHyw8erd6jd5Ta/JIEcdCheXFt9b1NYb93a1wmIIVW/2gLkombDg==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.10.0 - '@typescript-eslint/visitor-keys': 6.10.0 - dev: true - /@typescript-eslint/scope-manager@6.21.0: resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -9786,37 +9821,11 @@ packages: - supports-color dev: true - /@typescript-eslint/types@6.10.0: - resolution: {integrity: sha512-36Fq1PWh9dusgo3vH7qmQAj5/AZqARky1Wi6WpINxB6SkQdY5vQoT2/7rW7uBIsPDcvvGCLi4r10p0OJ7ITAeg==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true - /@typescript-eslint/types@6.21.0: resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.10.0(typescript@5.2.2): - resolution: {integrity: sha512-ek0Eyuy6P15LJVeghbWhSrBCj/vJpPXXR+EpaRZqou7achUWL8IdYnMSC5WHAeTWswYQuP2hAZgij/bC9fanBg==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.10.0 - '@typescript-eslint/visitor-keys': 6.10.0 - debug: 4.3.4(supports-color@8.1.1) - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.2.2) - typescript: 5.2.2 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.2.2): resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -9839,25 +9848,6 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.10.0(eslint@8.54.0)(typescript@5.2.2): - resolution: {integrity: sha512-v+pJ1/RcVyRc0o4wAGux9x42RHmAjIGzPRo538Z8M1tVx6HOnoQBCX/NoadHQlZeC+QO2yr4nNSFWOoraZCAyg==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) - '@types/json-schema': 7.0.14 - '@types/semver': 7.5.5 - '@typescript-eslint/scope-manager': 6.10.0 - '@typescript-eslint/types': 6.10.0 - '@typescript-eslint/typescript-estree': 6.10.0(typescript@5.2.2) - eslint: 8.54.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /@typescript-eslint/utils@6.21.0(eslint@8.54.0)(typescript@5.2.2): resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -9877,14 +9867,6 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@6.10.0: - resolution: {integrity: sha512-xMGluxQIEtOM7bqFCo+rCMh5fqI+ZxV5RUUOa29iVPz1OgCZrtc7rFnz5cLUazlkPKYqX+75iuDq7m0HQ48nCg==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.10.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@typescript-eslint/visitor-keys@6.21.0: resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} engines: {node: ^16.0.0 || >=18.0.0} @@ -12446,6 +12428,17 @@ packages: node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) + /browserslist@4.22.3: + resolution: {integrity: sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001585 + electron-to-chromium: 1.4.661 + node-releases: 2.0.14 + update-browserslist-db: 1.0.13(browserslist@4.22.3) + dev: true + /bser@2.1.1: resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} dependencies: @@ -12732,6 +12725,10 @@ packages: /caniuse-lite@1.0.30001551: resolution: {integrity: sha512-vtBAez47BoGMMzlbYhfXrMV1kvRF2WP/lqiMuDu1Sb4EE4LKEgjopFDSRtZfdVnslNRpOqV/woE+Xgrwj6VQlg==} + /caniuse-lite@1.0.30001585: + resolution: {integrity: sha512-yr2BWR1yLXQ8fMpdS/4ZZXpseBgE7o4g41x3a6AJOqZuOi+iE/WdJYAuZ6Y95i4Ohd2Y+9MzIWRR+uGABH4s3Q==} + dev: true + /capture-exit@2.0.0: resolution: {integrity: sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==} engines: {node: 6.* || 8.* || >= 10.*} @@ -12941,6 +12938,11 @@ packages: engines: {node: '>=8'} dev: true + /ci-info@4.0.0: + resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} + engines: {node: '>=8'} + dev: true + /cipher-base@1.0.4: resolution: {integrity: sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==} dependencies: @@ -13396,6 +13398,12 @@ packages: browserslist: 4.22.1 dev: true + /core-js-compat@3.35.1: + resolution: {integrity: sha512-sftHa5qUJY3rs9Zht1WEnmkvXputCyDBczPnr7QDgL8n3qrF3CMXY4VPSYtOLLiOUJcah2WNXREd48iOl6mQIw==} + dependencies: + browserslist: 4.22.3 + dev: true + /core-js-pure@3.25.0: resolution: {integrity: sha512-IeHpLwk3uoci37yoI2Laty59+YqH9x5uR65/yiA0ARAJrTrN4YU0rmauLWfvqOuk77SlNJXj2rM6oT/dBD87+A==} requiresBuild: true @@ -14303,13 +14311,6 @@ packages: path-type: 4.0.0 dev: true - /doctrine@2.1.0: - resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} - engines: {node: '>=0.10.0'} - dependencies: - esutils: 2.0.3 - dev: true - /doctrine@3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} @@ -14538,6 +14539,10 @@ packages: /electron-to-chromium@1.4.561: resolution: {integrity: sha512-eS5t4ulWOBfVHdq9SW2dxEaFarj1lPjvJ8PaYMOjY0DecBaj/t4ARziL2IPpDr4atyWwjLFGQ2vo/VCgQFezVQ==} + /electron-to-chromium@1.4.661: + resolution: {integrity: sha512-AFg4wDHSOk5F+zA8aR+SVIOabu7m0e7BiJnigCvPXzIGy731XENw/lmNxTySpVFtkFEy+eyt4oHhh5FF3NjQNw==} + dev: true + /elliptic@6.5.4: resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} dependencies: @@ -15128,8 +15133,18 @@ packages: eslint: 8.54.0 dev: true - /eslint-config-flat-gitignore@0.1.1: - resolution: {integrity: sha512-ysq0QpN63+uaxE67U0g0HeCweIpv8Ztp7yvm0nYiM2TBalRIG6KQLO5J6lAz2gkA8KVis/QsJppe+BR5VigtWQ==} + /eslint-compat-utils@0.4.1(eslint@8.54.0): + resolution: {integrity: sha512-5N7ZaJG5pZxUeNNJfUchurLVrunD1xJvyg5kYOIVF8kg1f3ajTikmAu/5fZ9w100omNPOoMjngRszh/Q/uFGMg==} + engines: {node: '>=12'} + peerDependencies: + eslint: '>=6.0.0' + dependencies: + eslint: 8.54.0 + semver: 7.5.4 + dev: true + + /eslint-config-flat-gitignore@0.1.2: + resolution: {integrity: sha512-PcBsqtd5QHEZH4ROvpnRN4EP0qcHh9voCCHgtyHxnJZHGspJREcZn7oPqRG/GfWt9m3C0fkC2l5CuBtMig2wXQ==} dependencies: parse-gitignore: 2.0.0 dev: true @@ -15144,6 +15159,14 @@ packages: - supports-color dev: true + /eslint-merge-processors@0.1.0(eslint@8.54.0): + resolution: {integrity: sha512-IvRXXtEajLeyssvW4wJcZ2etxkR9mUf4zpNwgI+m/Uac9RfXHskuJefkHUcawVzePnd6xp24enp5jfgdHzjRdQ==} + peerDependencies: + eslint: '*' + dependencies: + eslint: 8.54.0 + dev: true + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} @@ -15173,16 +15196,16 @@ packages: - supports-color dev: true - /eslint-plugin-antfu@1.0.13(eslint@8.54.0): - resolution: {integrity: sha512-JzWEzNWZcNK4Q4Tz4VaNELhu3VgCv3obSYxUbK1UhbDBmr2v0a7H9n9xGv5GTS4LkEo905/2Gq6y0dcoBq5FZA==} + /eslint-plugin-antfu@2.1.2(eslint@8.54.0): + resolution: {integrity: sha512-s7ZTOM3uq0iqpp6gF0UEotnvup7f2PHBUftCytLZX0+6C9j9KadKZQh6bVVngAyFgsmeD9+gcBopOYLClb2oDg==} peerDependencies: eslint: '*' dependencies: eslint: 8.54.0 dev: true - /eslint-plugin-es-x@7.3.0(eslint@8.54.0): - resolution: {integrity: sha512-W9zIs+k00I/I13+Bdkl/zG1MEO07G97XjUSQuH117w620SJ6bHtLUmoMvkGA2oYnI/gNdr+G7BONLyYnFaLLEQ==} + /eslint-plugin-es-x@7.5.0(eslint@8.54.0): + resolution: {integrity: sha512-ODswlDSO0HJDzXU0XvgZ3lF3lS3XAZEossh15Q2UHjwrJggWeBoKqqEsLTZLXl+dh5eOAozG0zRcYtuE35oTuQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: eslint: '>=8' @@ -15190,6 +15213,7 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) '@eslint-community/regexpp': 4.10.0 eslint: 8.54.0 + eslint-compat-utils: 0.1.2(eslint@8.54.0) dev: true /eslint-plugin-eslint-comments@3.2.0(eslint@8.54.0): @@ -15203,21 +15227,20 @@ packages: ignore: 5.2.4 dev: true - /eslint-plugin-i@2.29.0(@typescript-eslint/parser@6.21.0)(eslint@8.54.0): - resolution: {integrity: sha512-slGeTS3GQzx9267wLJnNYNO8X9EHGsc75AKIAFvnvMYEcTJKotPKL1Ru5PIGVHIVet+2DsugePWp8Oxpx8G22w==} + /eslint-plugin-i@2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.54.0): + resolution: {integrity: sha512-ORizX37MelIWLbMyqI7hi8VJMf7A0CskMmYkB+lkCX3aF4pkGV7kwx5bSEb4qx7Yce2rAf9s34HqDRPjGRZPNQ==} engines: {node: '>=12'} peerDependencies: eslint: ^7.2.0 || ^8 dependencies: - debug: 3.2.7(supports-color@8.1.1) - doctrine: 2.1.0 + debug: 4.3.4(supports-color@8.1.1) + doctrine: 3.0.0 eslint: 8.54.0 eslint-import-resolver-node: 0.3.9 eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0) get-tsconfig: 4.7.2 is-glob: 4.0.3 minimatch: 3.1.2 - resolve: 1.22.8 semver: 7.5.4 transitivePeerDependencies: - '@typescript-eslint/parser' @@ -15226,13 +15249,13 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@46.9.0(eslint@8.54.0): - resolution: {integrity: sha512-UQuEtbqLNkPf5Nr/6PPRCtr9xypXY+g8y/Q7gPa0YK7eDhh0y2lWprXRnaYbW7ACgIUvpDKy9X2bZqxtGzBG9Q==} - engines: {node: '>=16'} + /eslint-plugin-jsdoc@48.0.6(eslint@8.54.0): + resolution: {integrity: sha512-LgwXOX6TWxxFYcbdVe+BJ94Kl/pgjSPYHLzqEdAMXTA1BH9WDx7iJ+9/iDajPF64LtzWX8C1mCfpbMZjJGhAOw==} + engines: {node: '>=18'} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 + eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 dependencies: - '@es-joy/jsdoccomment': 0.41.0 + '@es-joy/jsdoccomment': 0.42.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 debug: 4.3.4(supports-color@8.1.1) @@ -15240,23 +15263,26 @@ packages: eslint: 8.54.0 esquery: 1.5.0 is-builtin-module: 3.2.1 - semver: 7.5.4 - spdx-expression-parse: 3.0.1 + semver: 7.6.0 + spdx-expression-parse: 4.0.0 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-jsonc@2.10.0(eslint@8.54.0): - resolution: {integrity: sha512-9d//o6Jyh4s1RxC9fNSt1+MMaFN2ruFdXPG9XZcb/mR2KkfjADYiNL/hbU6W0Cyxfg3tS/XSFuhl5LgtMD8hmw==} + /eslint-plugin-jsonc@2.13.0(eslint@8.54.0): + resolution: {integrity: sha512-2wWdJfpO/UbZzPDABuUVvlUQjfMJa2p2iQfYt/oWxOMpXCcjuiMUSaA02gtY/Dbu82vpaSqc+O7Xq6ECHwtIxA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) eslint: 8.54.0 - eslint-compat-utils: 0.1.2(eslint@8.54.0) + eslint-compat-utils: 0.4.1(eslint@8.54.0) + espree: 9.6.1 + graphemer: 1.4.0 jsonc-eslint-parser: 2.4.0 natural-compare: 1.4.0 + synckit: 0.6.2 dev: true /eslint-plugin-markdown@3.0.1(eslint@8.54.0): @@ -15271,8 +15297,8 @@ packages: - supports-color dev: true - /eslint-plugin-n@16.3.1(eslint@8.54.0): - resolution: {integrity: sha512-w46eDIkxQ2FaTHcey7G40eD+FhTXOdKudDXPUO2n9WNcslze/i/HT2qJ3GXjHngYSGDISIgPNhwGtgoix4zeOw==} + /eslint-plugin-n@16.6.2(eslint@8.54.0): + resolution: {integrity: sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==} engines: {node: '>=16.0.0'} peerDependencies: eslint: '>=7.0.0' @@ -15280,8 +15306,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) builtins: 5.0.1 eslint: 8.54.0 - eslint-plugin-es-x: 7.3.0(eslint@8.54.0) + eslint-plugin-es-x: 7.5.0(eslint@8.54.0) get-tsconfig: 4.7.2 + globals: 13.24.0 ignore: 5.2.4 is-builtin-module: 3.2.1 is-core-module: 2.13.0 @@ -15295,7 +15322,7 @@ packages: engines: {node: '>=5.0.0'} dev: true - /eslint-plugin-perfectionist@2.5.0(eslint@8.54.0)(typescript@5.2.2)(vue-eslint-parser@9.3.2): + /eslint-plugin-perfectionist@2.5.0(eslint@8.54.0)(typescript@5.2.2)(vue-eslint-parser@9.4.2): resolution: {integrity: sha512-F6XXcq4mKKUe/SREoMGQqzgw6cgCgf3pFzkFfQVIGtqD1yXVpQjnhTepzhBeZfxZwgMzR9HO4yH4CUhIQ2WBcQ==} peerDependencies: astro-eslint-parser: ^0.16.0 @@ -15317,22 +15344,39 @@ packages: eslint: 8.54.0 minimatch: 9.0.3 natural-compare-lite: 1.4.0 - vue-eslint-parser: 9.3.2(eslint@8.54.0) + vue-eslint-parser: 9.4.2(eslint@8.54.0) transitivePeerDependencies: - supports-color - typescript dev: true - /eslint-plugin-unicorn@49.0.0(eslint@8.54.0): - resolution: {integrity: sha512-0fHEa/8Pih5cmzFW5L7xMEfUTvI9WKeQtjmKpTUmY+BiFCDxkxrTdnURJOHKykhtwIeyYsxnecbGvDCml++z4Q==} + /eslint-plugin-toml@0.9.2(eslint@8.54.0): + resolution: {integrity: sha512-ri0xf63PYf3pIq/WY9BIwrqxZmGTIwSkAO0bHddI0ajUwN4KGz6W8vOvdXFHOpRdRfzxlmXze/vfsY/aTEXESg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '>=6.0.0' + dependencies: + debug: 4.3.4(supports-color@8.1.1) + eslint: 8.54.0 + eslint-compat-utils: 0.4.1(eslint@8.54.0) + lodash: 4.17.21 + toml-eslint-parser: 0.9.3 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-unicorn@50.0.1(eslint@8.54.0): + resolution: {integrity: sha512-KxenCZxqSYW0GWHH18okDlOQcpezcitm5aOSz6EnobyJ6BIByiPDviQRjJIUAjG/tMN11958MxaQ+qCoU6lfDA==} engines: {node: '>=16'} peerDependencies: - eslint: '>=8.52.0' + eslint: '>=8.56.0' dependencies: '@babel/helper-validator-identifier': 7.22.20 '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) - ci-info: 3.9.0 + '@eslint/eslintrc': 2.1.4 + ci-info: 4.0.0 clean-regexp: 1.0.0 + core-js-compat: 3.35.1 eslint: 8.54.0 esquery: 1.5.0 indent-string: 4.0.0 @@ -15344,6 +15388,8 @@ packages: regjsparser: 0.10.0 semver: 7.5.4 strip-indent: 3.0.0 + transitivePeerDependencies: + - supports-color dev: true /eslint-plugin-unused-imports@3.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.54.0): @@ -15361,9 +15407,9 @@ packages: eslint-rule-composer: 0.3.0 dev: true - /eslint-plugin-vitest@0.3.9(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest): - resolution: {integrity: sha512-ZGrz8dWFlotM5dwrsMLP4VcY5MizwKNV4JTnY0VKdnuCZ+qeEUMHf1qd8kRGQA3tqLvXcV929wt2ANkduq2Pgw==} - engines: {node: 14.x || >= 16} + /eslint-plugin-vitest@0.3.22(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.54.0)(typescript@5.2.2)(vitest@packages+vitest): + resolution: {integrity: sha512-atkFGQ7aVgcuSeSMDqnyevIyUpfBPMnosksgEPrKE7Y8xQlqG/5z2IQ6UDau05zXaaFv7Iz8uzqvIuKshjZ0Zw==} + engines: {node: ^18.0.0 || >= 20.0.0} peerDependencies: '@typescript-eslint/eslint-plugin': '*' eslint: '>=8.0.0' @@ -15375,7 +15421,7 @@ packages: optional: true dependencies: '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.54.0)(typescript@5.2.2) - '@typescript-eslint/utils': 6.10.0(eslint@8.54.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.21.0(eslint@8.54.0)(typescript@5.2.2) eslint: 8.54.0 vitest: link:packages/vitest transitivePeerDependencies: @@ -15383,8 +15429,8 @@ packages: - typescript dev: true - /eslint-plugin-vue@9.18.1(eslint@8.54.0): - resolution: {integrity: sha512-7hZFlrEgg9NIzuVik2I9xSnJA5RsmOfueYgsUGUokEDLJ1LHtxO0Pl4duje1BriZ/jDWb+44tcIlC3yi0tdlZg==} + /eslint-plugin-vue@9.21.1(eslint@8.54.0): + resolution: {integrity: sha512-XVtI7z39yOVBFJyi8Ljbn7kY9yHzznKXL02qQYn+ta63Iy4A9JFBw6o4OSB9hyD2++tVT+su9kQqetUyCCwhjw==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.2.0 || ^7.0.0 || ^8.0.0 @@ -15395,21 +15441,21 @@ packages: nth-check: 2.1.1 postcss-selector-parser: 6.0.13 semver: 7.5.4 - vue-eslint-parser: 9.3.2(eslint@8.54.0) + vue-eslint-parser: 9.4.2(eslint@8.54.0) xml-name-validator: 4.0.0 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-yml@1.10.0(eslint@8.54.0): - resolution: {integrity: sha512-53SUwuNDna97lVk38hL/5++WXDuugPM9SUQ1T645R0EHMRCdBIIxGye/oOX2qO3FQ7aImxaUZJU/ju+NMUBrLQ==} + /eslint-plugin-yml@1.12.2(eslint@8.54.0): + resolution: {integrity: sha512-hvS9p08FhPT7i/ynwl7/Wt7ke7Rf4P2D6fT8lZlL43peZDTsHtH2A0SIFQ7Kt7+mJ6if6P+FX3iJhMkdnxQwpg==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' dependencies: debug: 4.3.4(supports-color@8.1.1) eslint: 8.54.0 - eslint-compat-utils: 0.1.2(eslint@8.54.0) + eslint-compat-utils: 0.4.1(eslint@8.54.0) lodash: 4.17.21 natural-compare: 1.4.0 yaml-eslint-parser: 1.2.2 @@ -15417,6 +15463,16 @@ packages: - supports-color dev: true + /eslint-processor-vue-blocks@0.1.1(@vue/compiler-sfc@3.4.5)(eslint@8.54.0): + resolution: {integrity: sha512-9+dU5lU881log570oBwpelaJmOfOzSniben7IWEDRYQPPWwlvaV7NhOtsTuUWDqpYT+dtKKWPsgz4OkOi+aZnA==} + peerDependencies: + '@vue/compiler-sfc': ^3.3.0 + eslint: ^8.50.0 + dependencies: + '@vue/compiler-sfc': 3.4.5 + eslint: 8.54.0 + dev: true + /eslint-rule-composer@0.3.0: resolution: {integrity: sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==} engines: {node: '>=4.0.0'} @@ -16911,6 +16967,13 @@ packages: type-fest: 0.20.2 dev: true + /globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} + engines: {node: '>=8'} + dependencies: + type-fest: 0.20.2 + dev: true + /globalthis@1.0.3: resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} engines: {node: '>= 0.4'} @@ -19361,7 +19424,7 @@ packages: resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.11.2 + acorn: 8.11.3 eslint-visitor-keys: 3.4.3 espree: 9.6.1 semver: 7.5.4 @@ -20780,6 +20843,10 @@ packages: /node-releases@2.0.13: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} + dev: true + /nopt@6.0.0: resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -23415,6 +23482,14 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -23896,6 +23971,13 @@ packages: spdx-license-ids: 3.0.12 dev: true + /spdx-expression-parse@4.0.0: + resolution: {integrity: sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==} + dependencies: + spdx-exceptions: 2.3.0 + spdx-license-ids: 3.0.12 + dev: true + /spdx-expression-validate@2.0.0: resolution: {integrity: sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg==} dependencies: @@ -24614,6 +24696,13 @@ packages: resolution: {integrity: sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g==} dev: true + /synckit@0.6.2: + resolution: {integrity: sha512-Vhf+bUa//YSTYKseDiiEuQmhGCoIF3CVBhunm3r/DQnYiGT4JssmnKQc44BIyOZRK2pKjXXAgbhfmbeoC9CJpA==} + engines: {node: '>=12.20'} + dependencies: + tslib: 2.5.3 + dev: true + /tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} dev: true @@ -25001,6 +25090,13 @@ packages: engines: {node: '>=0.6'} dev: true + /toml-eslint-parser@0.9.3: + resolution: {integrity: sha512-moYoCvkNUAPCxSW9jmHmRElhm4tVJpHL8ItC/+uYD0EpPSFXbck7yREz9tNdJVTSpHVod8+HoipcpbQ0oE6gsw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + eslint-visitor-keys: 3.4.3 + dev: true + /totalist@3.0.0: resolution: {integrity: sha512-eM+pCBxXO/njtF7vdFsHuqb+ElbxqtI4r5EAvk6grfAFyJ6IvWlSkfZ5T9ozC6xWw3Fj1fGoSmrl0gUs46JVIw==} engines: {node: '>=6'} @@ -25679,6 +25775,17 @@ packages: escalade: 3.1.1 picocolors: 1.0.0 + /update-browserslist-db@1.0.13(browserslist@4.22.3): + resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + dependencies: + browserslist: 4.22.3 + escalade: 3.1.1 + picocolors: 1.0.0 + dev: true + /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -25882,7 +25989,7 @@ packages: vfile-message: 2.0.4 dev: true - /vite-plugin-pages@0.31.0(vite@5.0.12): + /vite-plugin-pages@0.31.0(@vue/compiler-sfc@3.4.5)(vite@5.0.12): resolution: {integrity: sha512-fw3onBfVTXQI7rOzAbSZhmfwvk50+3qNnGZpERjmD93c8nEjrGLyd53eFXYMxcJV4KA1vzi4qIHt2+6tS4dEMw==} peerDependencies: '@vue/compiler-sfc': ^2.7.0 || ^3.0.0 @@ -25892,6 +25999,7 @@ packages: optional: true dependencies: '@types/debug': 4.1.12 + '@vue/compiler-sfc': 3.4.5 debug: 4.3.4(supports-color@8.1.1) deep-equal: 2.2.1 extract-comments: 1.1.0 @@ -26165,8 +26273,8 @@ packages: vue: 3.4.5(typescript@5.2.2) dev: true - /vue-eslint-parser@9.3.2(eslint@8.54.0): - resolution: {integrity: sha512-q7tWyCVaV9f8iQyIA5Mkj/S6AoJ9KBN8IeUSf3XEmBrOtxOZnfTg5s4KClbZBCK3GtnT/+RyCLZyDHuZwTuBjg==} + /vue-eslint-parser@9.4.2(eslint@8.54.0): + resolution: {integrity: sha512-Ry9oiGmCAK91HrKMtCrKFWmSFWvYkpGglCeFAIqDdr9zdXmMMpJOmUJS7WWsW7fX81h6mwHmUZCQQ1E0PkSwYQ==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' diff --git a/test/core/test/jest-expect.test.ts b/test/core/test/jest-expect.test.ts index 58e0848a6..0fce503bf 100644 --- a/test/core/test/jest-expect.test.ts +++ b/test/core/test/jest-expect.test.ts @@ -9,10 +9,10 @@ class TestError extends Error {} // For expect.extend interface CustomMatchers { - toBeDividedBy(divisor: number): R - toBeTestedAsync(): Promise - toBeTestedSync(): R - toBeTestedPromise(): R + toBeDividedBy: (divisor: number) => R + toBeTestedAsync: () => Promise + toBeTestedSync: () => R + toBeTestedPromise: () => R } declare module 'vitest' { @@ -24,7 +24,7 @@ declare global { // eslint-disable-next-line ts/no-namespace namespace jest { interface Matchers { - toBeJestCompatible(): R + toBeJestCompatible: () => R } } } diff --git a/test/core/test/utils.spec.ts b/test/core/test/utils.spec.ts index f06679215..4c33f8ab8 100644 --- a/test/core/test/utils.spec.ts +++ b/test/core/test/utils.spec.ts @@ -3,7 +3,7 @@ import { assertTypes, deepClone, objectAttr, toArray } from '@vitest/utils' import { deepMerge, resetModules } from '../../../packages/vitest/src/utils' import { deepMergeSnapshot } from '../../../packages/snapshot/src/port/utils' import type { EncodedSourceMap } from '../../../packages/vite-node/src/types' -import { ModuleCacheMap } from '../../../packages/vite-node/dist/client' +import { ModuleCacheMap } from '../../../packages/vite-node/src/client' describe('assertTypes', () => { test('the type of value should be number', () => { diff --git a/test/coverage-test/custom-provider.ts b/test/coverage-test/custom-provider.ts index 2a8f7d6e6..b4e45c405 100644 --- a/test/coverage-test/custom-provider.ts +++ b/test/coverage-test/custom-provider.ts @@ -52,7 +52,7 @@ class CustomCoverageProvider implements CoverageProvider { this.calls.add(`initialized ${ctx ? 'with' : 'without'} context`) } - clean(force: boolean) { + clean(force?: boolean) { this.calls.add(`clean ${force ? 'with' : 'without'} force`) } diff --git a/test/coverage-test/test/configuration-options.test-d.ts b/test/coverage-test/test/configuration-options.test-d.ts index f5f60cdcf..e622ae91a 100644 --- a/test/coverage-test/test/configuration-options.test-d.ts +++ b/test/coverage-test/test/configuration-options.test-d.ts @@ -120,7 +120,7 @@ test('provider module', () => { processingConcurrency: 1, } }, - clean(_: boolean) {}, + clean(_?: boolean) {}, onBeforeFilesRun() {}, onAfterSuiteRun({ coverage: _coverage }) {}, reportCoverage() {}, -- 2.51.2