Bhaumin
Bhaumin2mo ago

Understanding deno test Behavior with Interdependent Modules

I'm seeking clarification on how Deno's test runner (deno test) manages interdependent modules. Consider the following module dependencies: Module A depends on Module B Module B depends on Module C If I execute deno test for Module A, will the test runner automatically execute the test cases for Modules B and C, given their dependency chain? If this automatic execution isn't currently supported, are there any plans to implement such a feature in future releases? If this functionality is not available and there are no existing plans to include it, would it be appropriate for me to submit a feature request or open an issue to discuss its potential implementation? Thank you for your insights.
20 Replies
bartlomieju
bartlomieju2mo ago
deno test executes all tests in the files it discovers So it should just work right now
Bhaumin
BhauminOP2mo ago
ok but dag manner test cases execution possible right now?
bartlomieju
bartlomieju2mo ago
I don't really understand what you mean here. If you have a_test.ts that pulls b_test.ts that pulls c_test.ts then Deno will discover all 3 files and run tests from it
Bhaumin
BhauminOP2mo ago
yes and in dag manner
bartlomieju
bartlomieju2mo ago
Do you have a concrete example or a repo that you can share?
Bhaumin
BhauminOP2mo ago
ok i will share. thanks for support
Bhaumin
BhauminOP2mo ago
we want to run test cases in this manner, no if i run a_test.ts then it should automatically detect what test cases needs to be executed first.
No description
bartlomieju
bartlomieju2mo ago
Then no, this is not supported
Bhaumin
BhauminOP2mo ago
any work in progress or issue/pr to track work if no then should i create issue? i think cli is already using deno_graph and that features can be extended to deno test also...so what you suggest?
bartlomieju
bartlomieju2mo ago
Feel free to open an issue, there's none atm But please include a better example because I'm still not sure if I understand the request
Doctor 🤖
Doctor 🤖2mo ago
Is module A, B and C in a workspace or individual?
Bhaumin
BhauminOP2mo ago
it's in workspace, then it is possible? or any other way?
Doctor 🤖
Doctor 🤖2mo ago
When you do deno test it will execute all the tests in the workspace. If you specify for it to only do module As tests then it will only do module As test. It won't go down As dependencies looking for tests available for its dependencies. How you want it to work isn't possible as there is no connection between the code's dependencies to the code's dependency's tests.
Bhaumin
BhauminOP2mo ago
Okay got it, but is there any way to achieve this or needs to be implemented as a core feature in the deno cli test?
Doctor 🤖
Doctor 🤖2mo ago
It's not possible to do it the way you want it. You either execute all the tests or specify exactly which tests.
Bhaumin
BhauminOP2mo ago
it can be automated if the deno project is fully in workspace manner and by using deno_graph for this and then all test cases can be executed automatically in the required dag manner? After implementing such a feature only i am asking, is it possible right?
Doctor 🤖
Doctor 🤖2mo ago
What does dag mean
Bhaumin
BhauminOP2mo ago
Directly acyclic graph @Doctor 🤖 this one
Doctor 🤖
Doctor 🤖2mo ago
It's not currently available to test it in the manner you want and it's unlikely that it will become available
Bhaumin
BhauminOP2mo ago
ok thanks for clarity