Skip to content
/ vitest Public

A Dagger toolchain for vitest - a test framework for Vite.js

License

Notifications You must be signed in to change notification settings

dagger/vitest

Repository files navigation

@dagger.io/vitest

Vitest reporter with OpenTelemetry support for auto-instrumentation with Dagger.

Installation

With Dagger

dagger toolchain install github.com/dagger/vitest

dagger check

As a library

npm install --save-dev @dagger.io/vitest

Usage

You can either set the flag --reporter=@dagger.io/vitest or update your vitest config file to use the reporter:

import { defineConfig } from "vitest/config";
import DaggerReporter from "@dagger.io/vitest";

export default defineConfig({
  test: {
    reporters: [
      "default", // Keep the default reporter for console output
      new OtelReporter(), // add `as any` if you got a typing issue
    ],
  },
});

That's it! The reporter will automatically create OpenTelemetry spans for:

  • Test files (modules)
  • Test suites (describe blocks)
  • Individual tests (it/test blocks)

Span Hierarchy

test-file.ts (module span)
  └─ describe block (suite span)
      ├─ test 1 (test span)
      └─ test 2 (test span)

License

Apache-2.0

About

A Dagger toolchain for vitest - a test framework for Vite.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •