UNPKG

@otel-test-runner/mocha-test

Version:

Mocha Test Runner with Open telemetry support for auto-instrumentation with dagger

48 lines (33 loc) 1.11 kB
# Mocha OTEL Test library A wrapper around [`mocha`](https://mochajs.org/next/) to automatically traces tests inside `dagger run` or `dagger call`. ### Installation ```shell npm install @otel-test-runner/mocha-test ``` ### Usage Instead of using the global `it`, `describe` etc..., import them from `@otel-test-runner/mocha-test`. ```ts import assert from "node:assert"; import { it, describe } from "@otel-test-runner/mocha-test"; it("single test", async () => { assert.strictEqual(1 + 1, 2); }); describe("test suite", () => { it("hello world", () => { assert.strictEqual(1 + 1, 2); }); ``` ### Current support - [x] it - [x] specify - [x] describe - [x] context - [x] `it|specify`.`skip|only` - [x] `describe|context`.`skip|only` - [x] this.`timeout|retries` - [x] tests.`forEach` - [x] [`QUnit`](https://mochajs.org/next/interfaces/qunit/) interface - [x] [`TDD`](https://mochajs.org/next/interfaces/tdd/) interface ### Dagger integration You can automatically view your traces on Dagger Cloud with that library. ![dagger-cloud-view-example](./assets/dagger-cloud-view-example.png)