-
Notifications
You must be signed in to change notification settings - Fork 843
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
stack list-dependencies
gives the same output regardless of target
#3695
Comments
At the moment, if one test suite depens on hspec or on a lib, then all test suites will be loaded with their corresponding libs: commercialhaskell/stack#3695
Thanks for the report! It should be possible to resolve this, but it will not exactly be a trivial change. I believe this is a symptom of what Cabal considers to be dependencies of a So, the current behavior is consistent with what would be installed if those targets were built, rather than the actual direct deps of those targets. I'm not sure which behavior is preferable, really, so marking this as a discussion issue rather than a bug. |
Thanks for the reply @mgsloan. Ah, that makes sense now. I see why keeping the current behaviour would be preferable. Or maybe add a new command to For what it's worth, my use case is this: I'm working on an editor plugin (similar to this) that provides code lenses for running tests (i'm only going to support hspec for now). On startup, the plugin checks which test suites there are (using |
@dcastro I see! That would be a lot of instances of intero. I think it might make sense for you to do something like This still leaves the problem of detecting the dependency on hspec. Certainly could have an option for
Note that if the project has never been built, then cabal files may not be generated. |
…ck script DirectDeps.hs Due to commercialhaskell/stack#3695
Thanks for the tip @mgsloan! I didn't know about Regarding I also considered loading a bunch of test-suites into one instance of intero, but then Thanks to your tip, I wrote a little stack script that outputs all the direct dependencies of each component of a stack project: it calls (I considered using the Thanks again! |
Great, glad it worked out! Changing the behavior of list-dependencies is indirectly tracked by #2800 and other issues, so closing this. In other words, since list-dependencies uses the same info as used for building, once the build behavior changes, this will change too. |
Thanks, I'll subscribe that issue and keep an eye on it! |
General summary/comments (optional)
When you have a project with multiple test suites (e.g.
unit-a
andunit-b
),stack list-dependencies <unit-a | unit-b>
will return a list with all the dependencies of all the test suites. I expected it to return the dependencies of the specified target only.Steps to reproduce
Change package.yaml so that it contains 2 test suites with different dependencies:
Expected
I expected the list of dependencies for
unit-b
to not includehspec
andmytest
.I expected the list of dependencies for
unit-a
to not includeace
.Actual
Stack printed the same list of dependencies for both
unit-a
andunit-b
, and that list includes the dependencies of both test suites.Stack version
Method of installation
Official binary from haskellstack.org
The text was updated successfully, but these errors were encountered: