{"id":"d79b5f4362efa6fe","repo":"vitest-dev/vitest","slug":"test-runner-doesn-t-support-test-artifacts","errorCode":null,"errorMessage":"Test runner doesn't support test artifacts.","messagePattern":"Test runner doesn't support test artifacts\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/runtime/runner/artifact.ts","lineNumber":73,"sourceCode":"\n    if (artifact.type === 'internal:annotation') {\n      artifact.annotation.location = artifact.location\n    }\n  }\n\n  if (Array.isArray(artifact.attachments)) {\n    for (const attachment of artifact.attachments) {\n      manageArtifactAttachment(attachment)\n    }\n  }\n\n  // annotations won't resolve as artifacts for backwards compatibility until next major\n  if (artifact.type === 'internal:annotation') {\n    return artifact\n  }\n\n  if (!runner.onTestArtifactRecord) {\n    throw new Error(`Test runner doesn't support test artifacts.`)\n  }\n\n  await finishSendTasksUpdate(runner)\n\n  const resolvedArtifact = await runner.onTestArtifactRecord(task, artifact)\n\n  task.artifacts.push(resolvedArtifact)\n\n  return resolvedArtifact as typeof artifact\n}\n\nconst table: string[] = []\nfor (let i = 65; i < 91; i++) {\n  table.push(String.fromCharCode(i)) // A-Z\n}\nfor (let i = 97; i < 123; i++) {\n  table.push(String.fromCharCode(i)) // a-z\n}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/runtime/runner/artifact.ts#L55-L91","documentation":"`recordArtifact` (`artifact.ts:73`) requires the active test runner to implement `onTestArtifactRecord` — the hook that serializes and forwards artifacts to the reporter. If the runner doesn't have it (legacy/custom/unsupported runner), this `Error` is thrown. Artifacts are an experimental, advanced feature that needs explicit runner support.","triggerScenarios":"Calling `recordArtifact(task, {...})` with a runner that lacks `onTestArtifactRecord`; running the code outside the standard Vitest runner; a custom runner that didn't implement the hook.","commonSituations":"Using `recordArtifact` in a script or non-runner context; a third-party runner; calling it where the standard runner isn't wired.","solutions":["Ensure you're running under the standard Vitest test runner.","If using a custom runner, implement `onTestArtifactRecord(task, artifact)` on it.","Gate the call on capability: check for the hook before invoking (see validationCode)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Guard recordArtifact on runner capability before calling it.\nimport { getRunner } from '../runner/suite'\nconst runner = getRunner()\nif (typeof runner.onTestArtifactRecord !== 'function') {\n  throw new Error('This runner does not support test artifacts')\n}\nawait recordArtifact(task, artifact)","typeGuard":null,"tryCatchPattern":"try {\n  await recordArtifact(task, artifact)\n} catch (e) {\n  if (e instanceof Error && /doesn't support test artifacts/.test(e.message)) {\n    // skip artifact recording on this runner\n  } else throw e\n}","preventionTips":["Gate recordArtifact calls on runner.onTestArtifactRecord existence.","Run under the standard Vitest runner when using artifacts.","If using a custom runner, implement onTestArtifactRecord."],"tags":["artifacts","runner","experimental","record-artifact"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}