Skip to content

Commit

Permalink
Merge pull request #191763 from branchvincent/codecov-cli
Browse files Browse the repository at this point in the history
codecov-cli: fix test
  • Loading branch information
BrewTestBot authored Sep 24, 2024
2 parents 252efbf + 20c03c9 commit 58d9e3b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Formula/c/codecov-cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,22 @@ def install
end

test do
require "securerandom"

assert_equal "codecovcli, version #{version}\n", shell_output("#{bin}/codecovcli --version")

# Unfortunately `shell_output` doesn't capture standard error
output = shell_output(["#{bin}/codecovcli create-report --commit-sha #{SecureRandom.hex(40)}",
"--slug test/repo --token #{SecureRandom.hex(10)} 2>&1"].join(" "))

["No config file could be found. Ignoring config.",
"Process Report creating complete",
"Report creating failed: {\"detail\":\"Not valid tokenless upload\"}"].each do |l|
assert_match l, output
end
(testpath/"coverage.json").write <<~EOS
{
"meta": { "format": 2 },
"files": {},
"totals": {
"covered_lines": 0,
"num_statements": 0,
"percent_covered": 100,
}
}
EOS

output = shell_output("#{bin}/codecovcli do-upload --commit-sha=mocksha --dry-run 2>&1")
assert_match "Found 1 coverage files to report", output
assert_match "Process Upload complete", output
end
end

0 comments on commit 58d9e3b

Please sign in to comment.