diff --git a/src/commands/check.cr b/src/commands/check.cr index 16ac7545..0cd3896a 100644 --- a/src/commands/check.cr +++ b/src/commands/check.cr @@ -17,7 +17,7 @@ module Shards end private def has_dependencies? - spec.dependencies.any? || !Shards.production? || spec.development_dependencies.any? + spec.dependencies.any? || (!Shards.production? && spec.development_dependencies.any?) end private def verify(dependencies) diff --git a/src/commands/list.cr b/src/commands/list.cr index 61555f9e..fc79ff82 100644 --- a/src/commands/list.cr +++ b/src/commands/list.cr @@ -30,7 +30,7 @@ module Shards # FIXME: duplicates Check#has_dependencies? private def has_dependencies? - spec.dependencies.any? || !Shards.production? || spec.development_dependencies.any? + spec.dependencies.any? || (!Shards.production? && spec.development_dependencies.any?) end end end diff --git a/test/integration/check_test.cr b/test/integration/check_test.cr index 53d0214b..be059d5f 100644 --- a/test/integration/check_test.cr +++ b/test/integration/check_test.cr @@ -30,6 +30,12 @@ class CheckCommandTest < Minitest::Test end end + def test_succeeds_without_dependencies_and_lockfile + with_shard({ name: "no_dependencies" }) do + run "shards check --no-color" + end + end + def test_fails_when_dependencies_are_missing with_shard({ dependencies: { web: "*" } }) do run "shards install"