-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--findRelatedTests for node:test #42992
Comments
/cc @nodejs/test_runner |
How would node determine this? jest does it because it has a bunch of complex code to build a dependency map - but node would have to actively parse all your code to find the static requires/imports, and would have to evaluate your code to find the dynamic ones. This seems like something way out of scope for node core to do. |
I'd expect node to determine the dependency map. If you think this feature is outside of node core, that's fair. Would still love to see this in node core if not now, maybe later on. |
I think that capability would need to land first, separately, before the test runner could use it. |
@ljharb @bestickley basically this PR kind of does that, node/lib/internal/test_runner/harness.js Lines 143 to 145 in 38327e7
|
"only when using |
I agree. I was just pointing out my PR lays the ground for that |
Totally agree, this would be very complex. I, for one, am interested in a simpler, more reliable test runner after having struggled for long enough with jest & the like. It's my hope that I think this feature would be more appropriate as a userland implementation. It's fairly complex and I think would also need to be too opinionated about what your project looks like (CJS? ESM? Typescript?), path resolution, and how changes should be identified. You can introduce a ton of config like jest does but that's best left to users IMO. A rough sketch of how I'd do it:
|
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
What is the problem this feature will solve?
I use lintstaged to run only the unit tests related to changed source files on each commit. I currently use jest with their CLI flag:
--findRelatedTests
(https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles). Could something similar be added to node:test?What is the feature you are proposing to solve the problem?
--findRelatedTests CLI flag
What alternatives have you considered?
Sticking with Jest or creating my own helper function.
The text was updated successfully, but these errors were encountered: