MCPcopy
hub / github.com/vitest-dev/vitest / failTask

Function failTask

packages/runner/src/run.ts:787–810  ·  view source on GitHub ↗
(result: TaskResult, err: unknown, diffOptions: DiffOptions | undefined)

Source from the content-addressed store, hash-verified

785}
786
787function failTask(result: TaskResult, err: unknown, diffOptions: DiffOptions | undefined) {
788 if (err instanceof PendingError) {
789 result.state = 'skip'
790 result.note = err.note
791 result.pending = true
792 return
793 }
794
795 if (err instanceof TestRunAbortError) {
796 result.state = 'skip'
797 result.note = err.message
798 return
799 }
800
801 result.state = 'fail'
802 const errors = Array.isArray(err) ? err : [err]
803 for (const e of errors) {
804 const errors = e instanceof AggregateError
805 ? e.errors.map(e => processError(e, diffOptions))
806 : [processError(e, diffOptions)]
807 result.errors ??= []
808 result.errors.push(...errors)
809 }
810}
811
812function markTasksAsSkipped(suite: Suite, runner: VitestRunner) {
813 suite.tasks.forEach((t) => {

Callers 3

callTestHooksFunction · 0.85
runTestFunction · 0.85
runSuiteFunction · 0.85

Calls 1

processErrorFunction · 0.90

Tested by

no test coverage detected