Skip to content

Conversation

@erdembayar
Copy link
Contributor

@erdembayar erdembayar commented Oct 13, 2022

Bug

Fixes: NuGet/Home#7752

Regression? Last working version:

Description

Implement Dotnet List Package Machine Readable Json Output spec (spec PR), e.g. dotnet list package --format json will give you json output.
If there any error with json generation then application will return non-zero value.
This PR also include MVC style refactoring of the existing dotnet list package to console output logic.
Here get the report model/data

(int exitCode, ListPackageReportModel reportModel) = await GetReportDataAsync(listPackageArgs);
and it's shared by both console and json output options. So that means any existing tests like DotnetListPackageTests.cs already covers up until
point, this reduces the need for adding many duplicate tests. Only after this implementation details diverge between them, so I added tests for json report Renderer implementation by passing report model.
I added most basic unit tests, I'll add more later if needed.

PR Checklist

@erdembayar erdembayar force-pushed the dev-eryondon-dotnetlistpackage-jsonoutput branch 15 times, most recently from 2d69c1a to 9d12028 Compare October 18, 2022 02:17
@erdembayar erdembayar force-pushed the dev-eryondon-dotnetlistpackage-jsonoutput branch 6 times, most recently from f9afd82 to 1d974c7 Compare October 18, 2022 22:27
@erdembayar erdembayar marked this pull request as ready for review October 18, 2022 22:39
@erdembayar erdembayar requested a review from a team as a code owner October 18, 2022 22:39
@erdembayar erdembayar force-pushed the dev-eryondon-dotnetlistpackage-jsonoutput branch 2 times, most recently from a637450 to ee4f557 Compare October 19, 2022 00:54
var projectAPath = Path.Combine(pathContext.SolutionRoot, "projectA.csproj");
var projectBPath = Path.Combine(pathContext.SolutionRoot, "projectB.csproj");

using (FileStream stream = new FileStream(consoleOutputFileName, FileMode.Create))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Json output is redirected to consoleOutput.txt file. Later this file content compared to expected output for assertion.

@erdembayar erdembayar force-pushed the dev-eryondon-dotnetlistpackage-jsonoutput branch from f41ee35 to abb5159 Compare November 2, 2022 02:34
Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments at this point.

There are some tests failing, so approving it wouldn't help much :D

@erdembayar erdembayar force-pushed the dev-eryondon-dotnetlistpackage-jsonoutput branch from bf7a26c to 4ce40e8 Compare November 3, 2022 01:00
@erdembayar erdembayar force-pushed the dev-eryondon-dotnetlistpackage-jsonoutput branch from 4ce40e8 to ff6b93b Compare November 3, 2022 01:35
@erdembayar erdembayar requested a review from nkolev92 November 3, 2022 15:37
@erdembayar erdembayar merged commit 0358502 into dev Nov 4, 2022
@erdembayar erdembayar deleted the dev-eryondon-dotnetlistpackage-jsonoutput branch November 4, 2022 15:24
@rohitcoder
Copy link

@nkolev92 @erdembayar I wanted to check if we have the same feature but for dependency graph relation. Something like showing child dependencies in the parent (Simply a dependency relation JSON graph).

@erdembayar
Copy link
Contributor Author

erdembayar commented Nov 7, 2022

@nkolev92 Nikolche Kolev FTE @erdembayar Erick Yondon FTE I wanted to check if we have the same feature but for dependency graph relation. Something like showing child dependencies in the parent (Simply a dependency relation JSON graph).

I don't believe we have one considering this is the 1st ever json output we have. You can create a feature request here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Machine readable output for dotnet list package

5 participants