File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -212,9 +212,16 @@ export function resolveConfig(
212212 resolved . related = toArray ( options . related ) . map ( file => resolve ( resolved . root , file ) )
213213
214214 if ( mode !== 'benchmark' ) {
215- // @ts -expect-error from CLI
216- const reporters = resolved . reporter ?? resolved . reporters
217- resolved . reporters = Array . from ( new Set ( toArray ( reporters ) ) ) . filter ( Boolean )
215+ // @ts -expect-error "reporter" is from CLI, should be absolute to the running directory
216+ // it is passed down as "vitest --reporter ../reporter.js"
217+ const cliReporters = toArray ( resolved . reporter || [ ] ) . map ( ( reporter : string ) => {
218+ // ./reporter.js || ../reporter.js, but not .reporters/reporter.js
219+ if ( / ^ \. \. ? \/ / . test ( reporter ) )
220+ return resolve ( process . cwd ( ) , reporter )
221+ return reporter
222+ } )
223+ const reporters = cliReporters . length ? cliReporters : resolved . reporters
224+ resolved . reporters = Array . from ( new Set ( toArray ( reporters as 'json' [ ] ) ) ) . filter ( Boolean )
218225 }
219226
220227 if ( ! resolved . reporters . length )
You can’t perform that action at this time.
0 commit comments