dd-trace instruments test frameworks to automatically report test results, durations, and failures to CI Visibility in Datadog. Each test run, suite, and session produces spans that integrate with the Datadog Test Optimization product.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/datadog/dd-trace-js/llms.txt
Use this file to discover all available pages before exploring further.
Supported frameworks
Jest
jestMocha
mochaCucumber
@cucumber/cucumberCypress
cypressPlaywright
@playwright/testVitest
vitestSelenium
selenium-webdriverEnabling CI Visibility
CI Visibility activates automatically when a test framework plugin is loaded. Set these environment variables in your CI pipeline:Agentless mode requires
DD_API_KEY to be set. Agent mode requires a reachable Datadog Agent.Jest
dd-trace automatically patches Jest internals when any of thejest-circus, jest-runtime, jest-worker, @jest/core, or related packages are loaded.
- Test name, suite, and status (pass / fail / skip)
- Duration and error messages
- Code coverage when enabled
- CI environment metadata (branch, commit, pipeline URL)
Mocha
mocha-each package for parameterized tests is also automatically instrumented.
Cucumber
Cypress
For Cypress, add the dd-trace plugin to your Cypress configuration:Playwright
Vitest
Selenium
Theselenium-webdriver plugin instruments browser session spans:
Test tagging
Add custom tags to the active test span usingtracer.scope().active():
CI environment variables
dd-trace automatically reads standard CI environment variables to tag test spans with pipeline metadata.| Variable | Description |
|---|---|
DD_SERVICE | Service name for test spans. |
DD_ENV | Environment (e.g., ci, staging). |
DD_VERSION | Application version. |
DD_CIVISIBILITY_ENABLED | Enable CI Visibility. |
DD_CIVISIBILITY_AGENTLESS_ENABLED | Send results without an Agent. |
DD_API_KEY | Required for agentless mode. |
