(thrown: Thrown | null)
| 456 | }; |
| 457 | |
| 458 | const formatStack = (thrown: Thrown | null) => { |
| 459 | if (thrown === null || !thrown.isError) { |
| 460 | return ''; |
| 461 | } else { |
| 462 | const config = { |
| 463 | rootDir: process.cwd(), |
| 464 | testMatch: [], |
| 465 | }; |
| 466 | const options = { |
| 467 | noStackTrace: false, |
| 468 | }; |
| 469 | if (thrown.value instanceof AggregateError) { |
| 470 | return formatExecError(thrown.value, config, options); |
| 471 | } else { |
| 472 | return formatStackTrace( |
| 473 | separateMessageFromStack(thrown.value.stack!).stack, |
| 474 | config, |
| 475 | options, |
| 476 | ); |
| 477 | } |
| 478 | } |
| 479 | }; |
| 480 | |
| 481 | function createMessageAndCause(error: Error) { |
| 482 | if (error.cause) { |
no test coverage detected