feat: add Vitest support - #109
Conversation
132cedc to
54cbe83
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54cbe8316d
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49224b2d4e
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f2ab5d99b
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b5ed5dc3c
ℹ️ 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".
anmarchenko
left a comment
There was a problem hiding this comment.
Approved with one non-blocking suggestion
We will release the vitest support after we create a test playground and do a round of testing with shepherd QA agent
| // Add only missing Datadog preloads and preserve existing NODE_OPTIONS. | ||
| currentValue, _ := os.LookupEnv(nodeOptionsEnvVar) | ||
| requiredOptions := make([]string, 0, 2) | ||
| if settings.GetFramework() == "vitest" && !strings.Contains(currentValue, ddTraceRegisterModule) { |
There was a problem hiding this comment.
Non-blocking suggestion:
Could we keep GetPlatformEnv independent of the selected framework and add the Vitest-specific logic to DetectFramework?
DetectFramework already owns the Jest/Vitest selection, while this introduces a hidden global-settings dependency into an otherwise platform-only helper.
Something like:
func (j *JavaScript) DetectFramework() (framework.Framework, error) {
frameworkName := settings.GetFramework()
platformEnv := j.GetPlatformEnv()
var fw framework.Framework
switch frameworkName {
case "jest":
fw = framework.NewJest()
case "vitest":
platformEnv = addNodeImport(
platformEnv,
ddTraceRegisterModule,
)
fw = framework.NewVitest()
default:
return nil, ...
}
fw.SetPlatformEnv(platformEnv)
return fw, nil
}
There was a problem hiding this comment.
ack! I'm merging and I'll open a new PR to highlight this :) good catch
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
sebastian.condelorenzo@datadoghq.com unqueued this merge request |
|
/merge -c |
|
View all feedbacks in Devflow UI.
|
|
Recreated here: #111 |
What
Add basic
Vitestsupport toddtest, including suite-level planning and execution, Vitest-specific dd-trace initialization, native file discovery forVitest 2and newer, and config-aware discovery forVitest 1.6with a filesystem glob as the final fallback.Why
ddtestsupportsJavaScriptprojects usingJestbut cannot currently plan or runVitestsuites.Vitest 1.6also lacks thelist --filesOnlycommand available in later versions, so it needs a compatibility path that still respects project configuration.E2E testing
Focused validation completed:
Manual E2E scenario:
dd-trace-js 5.111or newer andVitest 1.6, including custom include/exclude rules or projects.ddtest plan --platform javascript --framework vitestand confirm only the files selected byVitestare planned.ddtest run --platform javascript --framework vitestand confirm the selected files execute with Test Optimization instrumentation.Vitest 2or newer to validate nativelist --filesOnlydiscovery.