Skip to content

Commit

Permalink
fix: BrowserTestRunner called incorrect super methods (vitest-dev#4632)
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor authored and LorenzoBloedow committed Dec 19, 2023
1 parent da33c85 commit eb41024
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/browser/src/client/runner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { File, TaskResultPack, Test } from '@vitest/runner'
import type { File, TaskResultPack, Test, VitestRunner } from '@vitest/runner'
import type { ResolvedConfig } from 'vitest'
import { rpc } from './rpc'

Expand All @@ -11,7 +11,10 @@ interface CoverageHandler {
takeCoverage: () => Promise<unknown>
}

export function createBrowserRunner(original: any, coverageModule: CoverageHandler | null) {
export function createBrowserRunner(
original: { new(config: ResolvedConfig): VitestRunner },
coverageModule: CoverageHandler | null,
): { new(options: BrowserRunnerOptions): VitestRunner } {
return class BrowserTestRunner extends original {
public config: ResolvedConfig
hashMap = new Map<string, [test: boolean, timstamp: string]>()
Expand All @@ -23,7 +26,7 @@ export function createBrowserRunner(original: any, coverageModule: CoverageHandl
}

async onAfterRunTask(task: Test) {
await super.onAfterRunTest?.(task)
await super.onAfterRunTask?.(task)
task.result?.errors?.forEach((error) => {
console.error(error.message)
})
Expand All @@ -39,8 +42,8 @@ export function createBrowserRunner(original: any, coverageModule: CoverageHandl
}
}

async onAfterRunFiles() {
await super.onAfterRun?.()
async onAfterRunFiles(files: File[]) {
await super.onAfterRunFiles?.(files)
const coverage = await coverageModule?.takeCoverage?.()

if (coverage) {
Expand Down

0 comments on commit eb41024

Please sign in to comment.