(feat) Use Jest native test file discovery#103
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3512349a5
ℹ️ 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".
juan-fernandez
left a comment
There was a problem hiding this comment.
I think using jest --listTests is a good default, as this will automatically detect custom jest configuration. This should work for most of the cases. There are nastier examples:
jestexecutable is not available. Maybeddtestis run before the install step?- the repo is multi-package. In this case,
jest --listTestsmight not work at all because each package might have different configurations
I say let's tackle those later on.
how does ruby do it? do they also rely on the test framework to get the list? Or is it a glob base search?
There was a problem hiding this comment.
More details
PR successfully adds Jest's native test file discovery via jest --listTests command. Implementation correctly handles path normalization, symlink resolution, and filters non-file output via os.Stat checks. All 20 test suites pass with no regressions. Framework interface abstraction works well, with other frameworks properly delegating to generic discovery helper.
📊 Validated against 8 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit e351234 · What is Autotest? · Any feedback? Reach out in #autotest
|
@juan-fernandez regarding the first point, I believe Ruby supports full discovery, so it can either do test file discovery using glob like us before this PR (look at |
|
Ruby assumes that test framework is available in the bundle (as well as tracer library) |
E2E Test Report: SUCCESSTested by: Shepherd Agent (autonomous QA for Datadog Test Optimization) Test Environment
Results
Issues FoundAn earlier E2E run found that instrumented Jest VerificationThe run used local mockdog rather than a real Datadog backend, so Datadog UI verification was not applicable. Backend payload behavior was verified through mockdog assertions:
Test Methodology
This E2E test was performed by Shepherd - autonomous QA agent for Datadog Test Optimization. |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 492899a | Docs | Datadog PR Page | Give us feedback! |
5ecaaed to
492899a
Compare
E2E Test Report: SUCCESSTested by: Shepherd Agent (autonomous QA for Datadog Test Optimization) Test Environment
Results
Verification
Test Methodology
Issues FoundNo issues found. This E2E test was performed by Shepherd - autonomous QA agent for Datadog Test Optimization. |
What does this PR do?
Use Jest’s native
--listTestscommand for Jest test file discovery instead of ddtest’s generic glob-based discovery.Motivation
Jest should decide which files belong to its test suite. Globbing by extension is fragile as ddtest adds more JavaScript test frameworks with overlapping file extensions.
This PR adds a framework-level fast file discovery hook so the planner stays framework-agnostic while Jest can use native discovery. Existing RSpec, Minitest, and PyTest behavior remains unchanged through the generic glob helper.