Skip to content

Commit

Permalink
refactor: rwview
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Dec 9, 2024
1 parent 3bb8f66 commit c89f42b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/coverage-istanbul/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { CoverageProviderModule } from 'vitest/node'
import type { IstanbulCoverageProvider } from './provider'
import { COVERAGE_STORE_KEY } from './constants'

export default <CoverageProviderModule>{
export default {
takeCoverage() {
// @ts-expect-error -- untyped global
return globalThis[COVERAGE_STORE_KEY]
Expand Down Expand Up @@ -46,4 +46,4 @@ export default <CoverageProviderModule>{

return new IstanbulCoverageProvider()
},
}
} satisfies CoverageProviderModule
4 changes: 2 additions & 2 deletions packages/coverage-v8/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let enabled = false

type ScriptCoverage = Awaited<ReturnType<typeof session.send<'Profiler.takePreciseCoverage'>>>

export default <CoverageProviderModule>{
export default {
async startCoverage() {
if (enabled) {
return
Expand Down Expand Up @@ -47,7 +47,7 @@ export default <CoverageProviderModule>{
async getProvider(): Promise<V8CoverageProvider> {
return loadProvider()
},
}
} satisfies CoverageProviderModule

function filterResult(coverage: ScriptCoverage['result'][number]): boolean {
if (!coverage.url.startsWith(window.location.origin)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/coverage-v8/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { loadProvider } from './load-provider'
const session = new inspector.Session()
let enabled = false

export default <CoverageProviderModule>{
export default {
startCoverage({ isolate }) {
if (isolate === false && enabled) {
return
Expand Down Expand Up @@ -55,7 +55,7 @@ export default <CoverageProviderModule>{
async getProvider(): Promise<V8CoverageProvider> {
return loadProvider()
},
}
} satisfies CoverageProviderModule

function filterResult(coverage: Profiler.ScriptCoverage): boolean {
if (!coverage.url.startsWith('file://')) {
Expand Down

0 comments on commit c89f42b

Please sign in to comment.