Jest
Official module: dagger/jest
Install with dagger mod install github.com/dagger/jest.
What It Is​
The Jest module runs Jest tests for JavaScript and TypeScript projects.
Use it when Jest is already the test runner for the repo and you want tests to become a Dagger check.
Use It For​
- Run Jest in CI and Dagger Cloud.
- Check one app or package in a larger workspace.
- List discovered tests when you need to debug test selection.
Main Workflows​
test: run the Jest suite.list: show which tests Jest sees.
How to Use It​
Install the module, then run its check:
dagger mod install github.com/dagger/jest
dagger check # run every check in the workspace
dagger check jest:test # run the Jest suite
test installs dependencies and runs the Jest 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 Jest config.
Settings​
List the current settings and their values with dagger settings jest, then set one with dagger settings jest <key> <value>. Settings are stored in .dagger/config.toml under [modules.jest.settings].
packageManager(defaultnpm): the package manager used to install dependencies before testing. Set it toyarnorpnpmto match the project.baseImageAddress(defaultnode:25-alpine): the Node base image tests run in. Pin it to the project's Node version, for examplenode:22-alpine.
[modules.jest.settings]
packageManager = "pnpm"
baseImageAddress = "node:22-alpine"
Test options​
The jest:test check runs with default options. Call the test function directly with dagger function call to override them:
files: limit the run to specific test files.build: run the project's build script before testing.useEnv: use the project's own Jest environment instead of the module's automatic OpenTelemetry environment.flags: extra flags passed through tojest.
Use list to print the tests Jest discovers when test selection is unclear.
Workspace Fit​
Use this module when Jest is the test runner. Use Vitest instead for projects built around Vitest or Vite-first test workflows.
Source​
Source repo: github.com/dagger/jest