diff --git a/packages/coverage-istanbul/src/index.ts b/packages/coverage-istanbul/src/index.ts index c9539885d663..1a317c8c908d 100644 --- a/packages/coverage-istanbul/src/index.ts +++ b/packages/coverage-istanbul/src/index.ts @@ -3,7 +3,7 @@ import type { CoverageProviderModule } from 'vitest/node' import type { IstanbulCoverageProvider } from './provider' import { COVERAGE_STORE_KEY } from './constants' -export default { +export default { takeCoverage() { // @ts-expect-error -- untyped global return globalThis[COVERAGE_STORE_KEY] @@ -46,4 +46,4 @@ export default { return new IstanbulCoverageProvider() }, -} +} satisfies CoverageProviderModule diff --git a/packages/coverage-v8/src/browser.ts b/packages/coverage-v8/src/browser.ts index 3ae9f51f463a..1891c7df296f 100644 --- a/packages/coverage-v8/src/browser.ts +++ b/packages/coverage-v8/src/browser.ts @@ -8,7 +8,7 @@ let enabled = false type ScriptCoverage = Awaited>> -export default { +export default { async startCoverage() { if (enabled) { return @@ -47,7 +47,7 @@ export default { async getProvider(): Promise { return loadProvider() }, -} +} satisfies CoverageProviderModule function filterResult(coverage: ScriptCoverage['result'][number]): boolean { if (!coverage.url.startsWith(window.location.origin)) { diff --git a/packages/coverage-v8/src/index.ts b/packages/coverage-v8/src/index.ts index 8fdc43640d08..9497648ea65b 100644 --- a/packages/coverage-v8/src/index.ts +++ b/packages/coverage-v8/src/index.ts @@ -7,7 +7,7 @@ import { loadProvider } from './load-provider' const session = new inspector.Session() let enabled = false -export default { +export default { startCoverage({ isolate }) { if (isolate === false && enabled) { return @@ -55,7 +55,7 @@ export default { async getProvider(): Promise { return loadProvider() }, -} +} satisfies CoverageProviderModule function filterResult(coverage: Profiler.ScriptCoverage): boolean { if (!coverage.url.startsWith('file://')) {