Repository navigation
Add option to print dependencies as tree - #4339
Conversation
mihaimaruseac
left a comment
There was a problem hiding this comment.
Just skimmed through this now, looks good.
With regards to a test you could make an integration test, then parse the output string to see if it contains what you are expecting to.
|
@akshaymankar Do shout if you need more pointers! We'll be happy to help. |
|
Hi, I am sorry, I got a little busy. I saw the integration tests, it seems easy enough. I will probably write the tests by the end of this week. |
|
I have added two tests, one for testing the whole dependency tree and another for testing that the |
f466a19 to
51c09e8
Compare
|
Looks like tests have failed due to some connection timeouts, I have rebased on top of lastest master and pushed again. Hopefully this will re-run the tests and they will pass. 🤞 |
|
Don't worry about Travis — CI doesn't run integration tests, anyway, so we'll have to run them ourselves before merging. |
|
Your integration test is failing on my build — I'll investigate but I'm sure it's my setup, or something minor (it's more worrying if other tests fail 👍) |
|
Thanks, @akshaymankar! Would you like to tackle the next items on #4101 (comment)? |
| payloadText opts payload = | ||
| if listDepsLicense opts | ||
| then maybe "<unknown>" (Text.pack . display . either licenseFromSPDX id) (payloadLicense payload) | ||
| else maybe "<unknown>" (Text.pack . show) (payloadVersion payload) |
There was a problem hiding this comment.
I think we want to use display rather than show, actually, to get an output without the mkVersion labels — but I'd need to check to confirm.
There was a problem hiding this comment.
Great catch, I was so invested in printing the tree that I forgot about version.
I've created a PR with the fix: #4413
|
I'll reply there. I would like to change the current representation, slightly — I missed it earlier. It can go in the next PR. |
Fixes #4101
Checklist
I think this is pretty discoverable by
stack ls dependencies --helpso I didn't add anything to the docs.How did I test this?
Unfortunately, manually. The
listDependenciesfunction was directly printing and had no tests and I built on top of that without much thought of testing. So, I couldn't add any automated tests.Here is output from
stack ls dependencies --depth=0 --treeon the stack repository:Depth=1 onwards, the output becomes really large, so I will not paste it here.
Additionally, if you could me some pointers around how to test this, I would be happy to add tests.