diff --git a/README.md b/README.md index 0dbee59e..b31220f3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Auto-detects your coverage artifact files and CI environment to post to [Coveral ``` $ coveralls -h -Coveralls Coverage Reporter v0.1.5 +Coveralls Coverage Reporter vX.Y.Z Usage coveralls [arguments] -rTOKEN, --repo-token=TOKEN Sets coveralls repo token, overrides settings in yaml or environment variable -cPATH, --config-path=PATH Set the coveralls yaml config file location, will default to check '.coveralls.yml' @@ -25,6 +25,7 @@ Usage coveralls [arguments] -d, --done Call webhook after all parallel jobs (-p) done. -n, --no-logo Do not show Coveralls logo in logs -q, --quiet Suppress all output + --debug Debug mode. Data being sent to Coveralls will be outputted to console. -h, --help Show this help ``` diff --git a/fixtures/test.lcov b/fixtures/test.lcov index dc70e114..94362a61 100644 --- a/fixtures/test.lcov +++ b/fixtures/test.lcov @@ -1,4 +1,3 @@ -make[1]: Entering directory `/home/cainus/urlgrey' SF:fixtures/test.js DA:1,1 DA:2,1 @@ -112,5 +111,4 @@ DA:218,21 DA:219,21 DA:220,21 DA:222,165 -end_of_record -make[1]: Leaving directory `/home/cainus/urlgrey' +end_of_record \ No newline at end of file diff --git a/shard.yml b/shard.yml index cde35ca3..4c73c5c8 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: coverage-reporter -version: 0.1.7 +version: 0.1.8 authors: - Jordan Oroshiba diff --git a/src/cli.cr b/src/cli.cr index 305d7191..e5f8076b 100644 --- a/src/cli.cr +++ b/src/cli.cr @@ -52,6 +52,10 @@ parser = OptionParser.parse do |parser| CoverageReporter.quiet! end + parser.on("--debug", "Debug mode. Data being sent to Coveralls will be outputted to console.") do + CoverageReporter.debug! + end + parser.on("-h", "--help", "Show this help") do # TODO: add environment variable notes puts "Coveralls Coverage Reporter v#{CoverageReporter::VERSION}" diff --git a/src/coverage_reporter.cr b/src/coverage_reporter.cr index 45b57364..4e2c0daa 100644 --- a/src/coverage_reporter.cr +++ b/src/coverage_reporter.cr @@ -2,7 +2,7 @@ require "./coverage_reporter/*" module CoverageReporter - VERSION = "0.1.7" + VERSION = "0.1.8" def self.run(coverage_file : String, repo_token : String | Nil, yaml_file_location : String, job_flag : String | Nil, parallel : Bool) yaml = YamlConfig.new(yaml_file_location) @@ -27,4 +27,12 @@ module CoverageReporter def self.quiet? @@quiet end + + def self.debug! + @@debug = true + end + + def self.debug? + @@debug + end end diff --git a/src/coverage_reporter/api.cr b/src/coverage_reporter/api.cr index 1d89df30..68c8ffb6 100644 --- a/src/coverage_reporter/api.cr +++ b/src/coverage_reporter/api.cr @@ -37,6 +37,10 @@ module CoverageReporter puts "šŸš€ Posting coverage data to #{api_url}" end + if debug? + puts "---\nā›‘ Debug Output:\n#{data.to_json}" + end + res = Crest.post( api_url, headers: { "Content-Type" => "application/json" }, @@ -85,6 +89,10 @@ module CoverageReporter } } + if debug? + puts "---\nā›‘ Debug Output:\n#{data.to_json}" + end + res = Crest.post( webhook_url, headers: { "Content-Type" => "application/json" }, @@ -119,5 +127,9 @@ module CoverageReporter private def quiet? CoverageReporter.quiet? end + + private def debug? + CoverageReporter.debug? + end end end