vitest-dev/vitest · error · Error
Test runner doesn't support test artifacts.
Error message
Test runner doesn't support test artifacts.
What it means
`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.
Source
Thrown at packages/vitest/src/runtime/runner/artifact.ts:73
if (artifact.type === 'internal:annotation') {
artifact.annotation.location = artifact.location
}
}
if (Array.isArray(artifact.attachments)) {
for (const attachment of artifact.attachments) {
manageArtifactAttachment(attachment)
}
}
// annotations won't resolve as artifacts for backwards compatibility until next major
if (artifact.type === 'internal:annotation') {
return artifact
}
if (!runner.onTestArtifactRecord) {
throw new Error(`Test runner doesn't support test artifacts.`)
}
await finishSendTasksUpdate(runner)
const resolvedArtifact = await runner.onTestArtifactRecord(task, artifact)
task.artifacts.push(resolvedArtifact)
return resolvedArtifact as typeof artifact
}
const table: string[] = []
for (let i = 65; i < 91; i++) {
table.push(String.fromCharCode(i)) // A-Z
}
for (let i = 97; i < 123; i++) {
table.push(String.fromCharCode(i)) // a-z
}View on GitHub (pinned to d568f8ce37)
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).
Defensive patterns
Strategy: validation
Validate before calling
// Guard recordArtifact on runner capability before calling it.
import { getRunner } from '../runner/suite'
const runner = getRunner()
if (typeof runner.onTestArtifactRecord !== 'function') {
throw new Error('This runner does not support test artifacts')
}
await recordArtifact(task, artifact) Try / catch
try {
await recordArtifact(task, artifact)
} catch (e) {
if (e instanceof Error && /doesn't support test artifacts/.test(e.message)) {
// skip artifact recording on this runner
} else throw e
} Prevention
- Gate recordArtifact calls on runner.onTestArtifactRecord existence.
- Run under the standard Vitest runner when using artifacts.
- If using a custom runner, implement onTestArtifactRecord.
When it happens
Trigger: 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.
Common situations: Using `recordArtifact` in a script or non-runner context; a third-party runner; calling it where the standard runner isn't wired.
Related errors
- Failed to import test file ${filepath}
- "Istanbul" coverage provider is not compatible with "experim
- Vitest Module Runner doesn't support Vite HMR events.
- Test attachment requires "body" or "path" to be set. Both ar
- Test attachment requires only one of "body" or "path" to be
AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03).
Data as JSON: /data/errors/d79b5f4362efa6fe.json.
Report an issue: GitHub.