Skip to content
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

Remove projects from list package output #5335

Merged
merged 5 commits into from
Aug 14, 2023

Conversation

Greybird
Copy link
Contributor

@Greybird Greybird commented Jul 26, 2023

Bug

Fixes: NuGet/Home#12585
Other PR: #5302
Design spec: NuGet/Home#12735

Regression? Last working version:

Description

list command, when used with the --include-transitive flag, but without any of the --deprecated, --outdated or --vulnerable ones, reports directly referenced projects as transitive dependencies.
This PR removes this behavior, and adds a test to ensure that with or without --include-transitive flag, a project is never returned by the list command

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@Greybird Greybird requested a review from a team as a code owner July 26, 2023 13:40
@ghost ghost added the Community PRs created by someone not in the NuGet team label Jul 26, 2023
zivkan
zivkan previously approved these changes Jul 26, 2023
@martinrrm martinrrm self-assigned this Jul 26, 2023
@Greybird
Copy link
Contributor Author

Greybird commented Aug 6, 2023

I see that the checks are having test failures, but they are passing locally, and I seem to have no way to get access to the results. If an action is needed from me, please ping me!

@zivkan
Copy link
Member

zivkan commented Aug 7, 2023

The "Apex Tests on Windows" are just flakey, ignore those.

For Windows func tests, the test Dotnet.Integration.Test.DotnetListPackageTests.DotnetListPackage_ProjectReference_Succeeds failed with error message:

Assert.Contains() Failure
Not found: ProjectB
In value:  Project 'ProjectA' has the following package references
[net46]: No packages were found for this framework.

The test only runs on Windows, so if you're using a different OS, then running test project will skip that test, although it's not clear to me why this test is Windows only. It looks extremely generic and should work the same on Linux & Mac.

But the test also looks fundamentally flawed to me. git blame says I wrote the test! I added it when I fixed a bug, but now I believe that it was just an easy way to hit the bug (use --outdated on a package that doesn't have any known versions on any package source). Though I was newish on the team at the time, so I'm not sure I would have questioned the weird behaviour at the time. Anyway, IMO the test should be changed to validate that dotnet list package --show-transitive does NOT show project references. This will ensure that nobody re-introduces this behaviour accidentally in the future.

@Greybird
Copy link
Contributor Author

Greybird commented Aug 7, 2023

@zivkan Thanks for the info!
As I had added a DotnetListPackage_DoesNotReturnProjects test to validate no projects were returned, I chose to remove DotnetListPackage_ProjectReference_Succeeds , and to add tests cases to mine to further validate the situation for no flags/--include-transitive for all (currently supported) report types.

@martinrrm martinrrm merged commit 23f5111 into NuGet:dev Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet list package --format json --include-transitive includes project references as transitive packages.
5 participants