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

Function serializeError

packages/vitest/src/node/ast-collect.ts:312–332  ·  view source on GitHub ↗
(ctx: TestProject, error: any)

Source from the content-addressed store, hash-verified

310}
311
312function serializeError(ctx: TestProject, error: any): TestError[] {
313 if ('errors' in error && 'pluginCode' in error) {
314 const errors = error.errors.map((e: any) => {
315 return {
316 name: error.name,
317 message: e.text,
318 stack: e.location
319 ? `${error.name}: ${e.text}\n at ${relative(ctx.config.root, e.location.file)}:${e.location.line}:${e.location.column}`
320 : '',
321 }
322 })
323 return errors
324 }
325 return [
326 {
327 name: error.name,
328 stack: error.stack,
329 message: error.message,
330 },
331 ]
332}
333
334function createFileTask(
335 testFilepath: string,

Callers 1

createFailedFileTaskFunction · 0.70

Calls 1

relativeFunction · 0.50

Tested by

no test coverage detected