Skip to content

Commit

Permalink
Output CLI errors in test assertions
Browse files Browse the repository at this point in the history
So there's more info about what failed to help with debugging
  • Loading branch information
brettchalupa committed Dec 10, 2024
1 parent fe16dba commit 9624df8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_cli_help
assert cmd("--help")
end
assert_match /Usage/, out
assert err.empty?, "errors not empty"
assert err.empty?, "errors not empty: #{err}"
end

def test_cli_verbose
Expand All @@ -41,14 +41,14 @@ def test_cli_verbose
end
assert_match /Generating site/, out
assert_match /Site successfully generated/, out
assert err.empty?, "errors not empty"
assert err.empty?, "errors not empty: #{err}"
end

def test_cli_base_url
out, err = capture_subprocess_io do
assert cmd("#{@schema} -b https://example.com")
end
assert err.empty?, "errors not empty"
assert err.empty?, "errors not empty: #{err}"
assert File.read(File.join("output", 'index.html')).include?("<link rel=\"stylesheet\" href=\"https://example.com/assets/style.css\">")
end

Expand All @@ -57,7 +57,7 @@ def test_cli_version
assert cmd("--version")
end
assert_match /#{GraphQLDocs::VERSION}/, out
assert err.empty?, "errors not empty"
assert err.empty?, "errors not empty: #{err}"
end

private
Expand Down

0 comments on commit 9624df8

Please sign in to comment.