Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reporter): load custom reporter using executeFile #2184

Merged
merged 5 commits into from Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vitest/src/node/reporters/utils.ts
Expand Up @@ -6,7 +6,7 @@ import type { BenchmarkBuiltinReporters, BuiltinReporters } from './index'
async function loadCustomReporterModule<C extends Reporter>(path: string, runner: ViteNodeRunner): Promise<new () => C> {
let customReporterModule: { default: new () => C }
try {
customReporterModule = await runner.executeId(path)
customReporterModule = await runner.executeFile(path)
}
catch (customReporterModuleError) {
throw new Error(`Failed to load custom Reporter from ${path}`, { cause: customReporterModuleError as Error })
Expand Down
2 changes: 1 addition & 1 deletion test/reporters/tests/utils.test.ts
Expand Up @@ -10,7 +10,7 @@ import TestReporter from '../src/custom-reporter'

const customReporterPath = resolve(__dirname, '../src/custom-reporter.js')
const fetchModule = {
executeId: (id: string) => import(id),
executeFile: (id: string) => import(id),
} as ViteNodeRunner

describe('Reporter Utils', () => {
Expand Down