From 3a92e03c544032053e91cf819ae99151b4edc006 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Fri, 27 Sep 2024 09:02:23 +0200 Subject: [PATCH] Fix `pub deps` behavior (#4397) --- lib/src/command/deps.dart | 4 ++-- test/deps_test.dart | 4 +++- .../goldens/deps/executables_test/dev dependencies.txt | 4 +++- test/workspace_test.dart | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/src/command/deps.dart b/lib/src/command/deps.dart index e197f3328..82a142a0c 100644 --- a/lib/src/command/deps.dart +++ b/lib/src/command/deps.dart @@ -130,8 +130,8 @@ class DepsCommand extends PubCommand { // before. Clients should opt to consume directDependencies and // devDependencies separately instead. 'dependencies': (isRoot - ? currentPackage.dependencies - : currentPackage.immediateDependencies) + ? currentPackage.immediateDependencies + : currentPackage.dependencies) .keys .toList(), 'directDependencies': currentPackage.dependencies.keys.toList(), diff --git a/test/deps_test.dart b/test/deps_test.dart index e90e5db2b..5983fce40 100644 --- a/test/deps_test.dart +++ b/test/deps_test.dart @@ -158,7 +158,9 @@ void main() { "dependencies": [ "normal", "overridden", - "from_path" + "from_path", + "unittest", + "override_only" ], "directDependencies": [ "normal", diff --git a/test/testdata/goldens/deps/executables_test/dev dependencies.txt b/test/testdata/goldens/deps/executables_test/dev dependencies.txt index d0b2ffa98..0e30ebcfb 100644 --- a/test/testdata/goldens/deps/executables_test/dev dependencies.txt +++ b/test/testdata/goldens/deps/executables_test/dev dependencies.txt @@ -34,7 +34,9 @@ $ pub deps --json "version": "0.0.0", "kind": "root", "source": "root", - "dependencies": [], + "dependencies": [ + "foo" + ], "directDependencies": [], "devDependencies": [ "foo" diff --git a/test/workspace_test.dart b/test/workspace_test.dart index e7d209565..1dc9a636c 100644 --- a/test/workspace_test.dart +++ b/test/workspace_test.dart @@ -591,7 +591,8 @@ transitive dependencies: "source": "root", "dependencies": [ "myapp", - "foo" + "foo", + "both" ], "directDependencies": [ "myapp",