Vitest
The Vitest module runs Vitest tests for JavaScript and TypeScript projects. Reach for it when the project uses Vitest, especially Vite apps and modern frontend packages, whether you want to run the suite as a workspace check, validate frontend packages and libraries, or list discovered tests when test selection is unclear.
Official module: dagger/vitest
Add it to your workspace
dagger install github.com/dagger/vitest
Run the tests
dagger check # run every check in the workspace
dagger check vitest:test # run the Vitest suite
vitest:test installs dependencies and runs the Vitest suite over the workspace (excluding node_modules, dist, and build). It automatically registers an OpenTelemetry hook, so individual tests appear as spans in the Dagger TUI and Dagger Cloud without changing the project's Vitest config.
Test options
The vitest:test check runs with default options. Call the test function directly with dagger api call to override them:
files: limit the run to specific test files.build: run the project's build script before testing.flags: extra flags passed through tovitest.
Use list to print the tests Vitest discovers when test selection is unclear.
Configure it
List the current settings and their values with dagger settings vitest, then set one with dagger settings vitest <key> <value>. They live in dagger.toml under [modules.vitest.settings]:
packageManager(defaultnpm): the package manager used to install dependencies before testing. Set it toyarnorpnpmto match the project; withpnpm, the module enables Corepack automatically.baseImageAddress(defaultnode:25-alpine): the Node base image tests run in. Pin it to the project's Node version, for examplenode:22-alpine.
[modules.vitest.settings]
packageManager = "pnpm"
baseImageAddress = "node:22-alpine"
Working with other modules
Use this module when Vitest is the test runner. Use Jest instead for projects that already depend on Jest conventions and config.