Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: less verbose CI output by default (#1087)
- Loading branch information
1 parent
eb13d34
commit a06f247
Showing
2 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import c from 'picocolors' | ||
import type { TaskResultPack } from '../../types' | ||
import { getFullName } from '../../utils' | ||
import { F_RIGHT } from '../../utils/figures' | ||
import { DefaultReporter } from './default' | ||
import { getStateSymbol } from './renderers/utils' | ||
|
||
export class VerboseReporter extends DefaultReporter { | ||
constructor() { | ||
super() | ||
this.rendererOptions.renderSucceed = true | ||
} | ||
|
||
onTaskUpdate(packs: TaskResultPack[]) { | ||
if (this.isTTY) | ||
return | ||
for (const pack of packs) { | ||
const task = this.ctx.state.idMap.get(pack[0]) | ||
if (task && task.type === 'test' && task.result?.state && task.result?.state !== 'run') { | ||
this.ctx.log(` ${getStateSymbol(task)} ${getFullName(task)}`) | ||
if (task.result.state === 'fail') | ||
this.ctx.log(c.red(` ${F_RIGHT} ${(task.result.error as any)?.message}`)) | ||
} | ||
} | ||
} | ||
} |