Skip to content

Plugin

1 exports Added in v4.0.0 Source

Testing

plugin

Added in v4.0.0 Source

Creates a Vite plugin that transforms marked documentation snippets into Vitest tests.

Details

Use Vitest's includeSource option to discover files containing import.meta.vitest. The plugin collects marked files through a collector module without executing the source module. Every snippet executes in its own module, with imports resolved relative to the original source file. Native in-source tests are not supported.

Signature

declare function plugin(): Plugin;