new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vitest · API reference · all subjects

testartifactregistry

3 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

TestArtifactRegistry custom artifact registration

TestArtifactRegistry interface is a registry for custom test artifact types. Augmenting this interface using TypeScript module augmentation allows registering custom artifact types that tests can produce. Each custom artifact should extend TestArtifactBase and include a unique type discriminator property.

Custom artifact best practices

Best practices for custom artifacts: try using a Symbol as the registry key to guarantee uniqueness; the type property should follow the pattern 'package-name:artifact-name' with 'internal:' being a reserved prefix; use attachments to include files or data and extend TestAttachment for custom metadata; if narrowing the attachments type (to a tuple), include | [] in the union since Vitest may empty the array at runtime; location property is automatically injected.

Custom artifact example with AccessibilityArtifact

Example of creating a custom artifact: Define an A11yReportAttachment interface extending TestAttachment with contentType: 'text/html' and path: string. Define an AccessibilityArtifact interface extending TestArtifactBase with type: 'a11y:report', passed: boolean, wcagLevel: 'A' | 'AA' | 'AAA', and attachments: [A11yReportAttachment] | []. Create a Symbol key (const a11yReportKey = Symbol('report')) and declare a module augmentation: declare module 'vitest' { interface TestArtifactRegistry { [a11yReportKey]: AccessibilityArtifact } }

Give your agent this brain