Bhaumin
Bhaumin5d 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
bartlomieju5d ago
deno test executes all tests in the files it discovers So it should just work right now
Bhaumin
BhauminOP5d ago
ok but dag manner test cases execution possible right now?
bartlomieju
bartlomieju5d 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
BhauminOP5d ago
yes and in dag manner
bartlomieju
bartlomieju5d ago
Do you have a concrete example or a repo that you can share?
Bhaumin
BhauminOP5d ago
ok i will share. thanks for support
Bhaumin
BhauminOP5d 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
bartlomieju5d ago
Then no, this is not supported
Bhaumin
BhauminOP5d 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
bartlomieju5d 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 🤖5d ago
Is module A, B and C in a workspace or individual?
Bhaumin
BhauminOP5d ago
it's in workspace, then it is possible? or any other way?
Doctor 🤖
Doctor 🤖5d 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
BhauminOP5d 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 🤖5d 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
BhauminOP5d 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 🤖5d ago
What does dag mean
Bhaumin
BhauminOP5d ago
Directly acyclic graph @Doctor 🤖 this one
Doctor 🤖
Doctor 🤖5d ago
It's not currently available to test it in the manner you want and it's unlikely that it will become available
Bhaumin
BhauminOP4d ago
ok thanks for clarity