(task: Test, artifact: Artifact)
| 39 | * ``` |
| 40 | */ |
| 41 | export async function recordArtifact<Artifact extends TestArtifact>(task: Test, artifact: Artifact): Promise<Artifact> { |
| 42 | const runner = getRunner() |
| 43 | |
| 44 | const stack = findTestFileStackTrace( |
| 45 | task.file.filepath, |
| 46 | new Error('STACK_TRACE').stack!, |
| 47 | ) |
| 48 | |
| 49 | if (stack) { |
| 50 | artifact.location = { |
| 51 | file: stack.file, |
| 52 | line: stack.line, |
| 53 | column: stack.column, |
| 54 | } |
| 55 | |
| 56 | if (artifact.type === 'internal:annotation') { |
| 57 | artifact.annotation.location = artifact.location |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | if (Array.isArray(artifact.attachments)) { |
| 62 | for (const attachment of artifact.attachments) { |
| 63 | manageArtifactAttachment(attachment) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // annotations won't resolve as artifacts for backwards compatibility until next major |
| 68 | if (artifact.type === 'internal:annotation') { |
| 69 | return artifact |
| 70 | } |
| 71 | |
| 72 | if (!runner.onTestArtifactRecord) { |
| 73 | throw new Error(`Test runner doesn't support test artifacts.`) |
| 74 | } |
| 75 | |
| 76 | await finishSendTasksUpdate(runner) |
| 77 | |
| 78 | const resolvedArtifact = await runner.onTestArtifactRecord(task, artifact) |
| 79 | |
| 80 | task.artifacts.push(resolvedArtifact) |
| 81 | |
| 82 | return resolvedArtifact as typeof artifact |
| 83 | } |
| 84 | |
| 85 | const table: string[] = [] |
| 86 | for (let i = 65; i < 91; i++) { |
no test coverage detected