-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
Change lib deps CLI command output to sorted alphabetically #1934
Conversation
Check failures are caused by flaky tests on Windows, please rerun them as I don't have permissions to do so. |
stdOut, _, err := cli.Run("lib", "deps", "[email protected]", "--no-color") | ||
require.NoError(t, err) | ||
lines := strings.Split(strings.TrimSpace(string(stdOut)), "\n") | ||
require.Len(t, lines, 7) | ||
require.Equal(t, "✓ Arduino_DebugUtils 1.3.0 is already installed.", lines[0]) | ||
require.Equal(t, "✓ MKRGSM 1.5.0 is already installed.", lines[1]) | ||
require.Equal(t, "✓ MKRNB 1.5.1 is already installed.", lines[2]) | ||
require.Equal(t, "✓ WiFiNINA 1.8.13 is already installed.", lines[3]) | ||
require.Equal(t, "✕ Arduino_ConnectionHandler 0.6.6 must be installed.", lines[4]) | ||
require.Equal(t, "✕ MKRWAN 1.1.0 must be installed.", lines[5]) | ||
require.Equal(t, "✕ WiFi101 0.16.1 must be installed.", lines[6]) | ||
|
||
stdOut, _, err = cli.Run("lib", "deps", "[email protected]", "--format", "json") | ||
require.NoError(t, err) | ||
expectedOutput := `{"dependencies":[ | ||
{"name":"Arduino_ConnectionHandler","version_required":"0.6.6"}, | ||
{"name":"Arduino_DebugUtils","version_required":"1.3.0","version_installed":"1.3.0"}, | ||
{"name":"MKRGSM","version_required":"1.5.0","version_installed":"1.5.0"}, | ||
{"name":"MKRNB","version_required":"1.5.1","version_installed":"1.5.1"}, | ||
{"name":"MKRWAN","version_required":"1.1.0"}, | ||
{"name":"WiFi101","version_required":"0.16.1"}, | ||
{"name":"WiFiNINA","version_required":"1.8.13","version_installed":"1.8.13"}]}` | ||
require.JSONEq(t, expectedOutput, string(stdOut)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing as in the other PR, this test will fail as soon as one of the libraries gets another release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, there's no way of setting the version of libraries' dependencies, didn't think about that.
I'll find a reliable way to test it.
Please check if the PR fulfills these requirements
See how to contribute
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)What kind of change does this PR introduce?
Enhances output of an existing command.
What is the current behavior?
lib deps
command output is non deterministic and always changes on subsequent calls, both in plain text and JSON.What is the new behavior?
Output of
lib deps
is now sorted alphabetically both in plain text and JSON.In plain text it's also sorted by installation state, dependencies that are installed are shown first.
Example plain text output:
Example json output:
Does this PR introduce a breaking change, and is titled accordingly?
Nope.
Other information
This will ease integration testing for a PR that fixes #1856.