-
-
Notifications
You must be signed in to change notification settings - Fork 406
Change lib deps CLI command output to sorted alphabetically #1934
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
Changes from 2 commits
394f752
43ba63f
5c16f95
473a7a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
package lib_test | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/arduino/arduino-cli/internal/integrationtest" | ||
|
@@ -136,3 +137,48 @@ func TestDuplicateLibInstallDetection(t *testing.T) { | |
require.Error(t, err) | ||
require.Contains(t, string(stdErr), "The library ArduinoOTA has multiple installations") | ||
} | ||
|
||
func TestLibDepsOutput(t *testing.T) { | ||
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) | ||
defer env.CleanUp() | ||
|
||
// Updates index for cores and libraries | ||
_, _, err := cli.Run("core", "update-index") | ||
require.NoError(t, err) | ||
_, _, err = cli.Run("lib", "update-index") | ||
require.NoError(t, err) | ||
|
||
// Install some libraries that are dependencies of another library | ||
_, _, err = cli.Run("lib", "install", "[email protected]") | ||
require.NoError(t, err) | ||
_, _, err = cli.Run("lib", "install", "[email protected]") | ||
require.NoError(t, err) | ||
_, _, err = cli.Run("lib", "install", "[email protected]") | ||
require.NoError(t, err) | ||
_, _, err = cli.Run("lib", "install", "[email protected]") | ||
require.NoError(t, err) | ||
|
||
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 commentThe 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 commentThe 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. |
||
} |
Uh oh!
There was an error while loading. Please reload this page.