Skip to content

feat: add Vitest support - #111

Merged
cbasitodx merged 8 commits into
mainfrom
sebas.conde/feat/add_vitest_support
Jul 28, 2026
Merged

feat: add Vitest support#111
cbasitodx merged 8 commits into
mainfrom
sebas.conde/feat/add_vitest_support

Conversation

@cbasitodx

Copy link
Copy Markdown
Contributor

What

Add basic Vitest support to ddtest, including suite-level planning and execution, Vitest-specific dd-trace initialization, native file discovery for Vitest 2 and newer, and config-aware discovery for Vitest 1.6 with a filesystem glob as the final fallback.

Why

ddtest supports JavaScript projects using Jest but cannot currently plan or run Vitest suites. Vitest 1.6 also lacks the list --filesOnly command available in later versions, so it needs a compatibility path that still respects project configuration.

E2E testing

Focused validation completed:

  • go test ./internal/framework ./internal/platform

Manual E2E scenario:

  1. Configure a JavaScript project with dd-trace-js 5.111 or newer and Vitest 1.6, including custom include/exclude rules or projects.
  2. Run ddtest plan --platform javascript --framework vitest and confirm only the files selected by Vitest are planned.
  3. Run ddtest run --platform javascript --framework vitest and confirm the selected files execute with Test Optimization instrumentation.
  4. Repeat with Vitest 2 or newer to validate native list --filesOnly discovery.

@cbasitodx
cbasitodx requested a review from a team as a code owner July 28, 2026 10:23

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

Vitest 2.1.9 native discovery and the Vitest 1.6 config-aware fallback both returned the expected configured test files, including exclusion and custom-pattern scenarios. Existing Go tests also passed; no clear diff-only behavioral regression was reproduced. No additional tests recommended: the PR already covers the exercised discovery branches and the remaining lint check is blocked by the sandbox toolchain mismatch.

Was this helpful? React 👍 or 👎

📊 Validated against 5 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit cfae9ea · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfae9ea69e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/framework/scripts/vitest_v1_discovery.mjs Outdated
Comment thread internal/framework/vitest.go
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 28, 2026

Copy link
Copy Markdown

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 84.62%
Overall Coverage: 87.41% (-0.16%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d9aab0a | Docs | Datadog PR Page | Give us feedback!

@cbasitodx
cbasitodx merged commit 8536d7f into main Jul 28, 2026
4 checks passed
@cbasitodx
cbasitodx deleted the sebas.conde/feat/add_vitest_support branch July 28, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants