Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
fossa test --json output with no issues to report (#387)
Browse files Browse the repository at this point in the history
* output json when there are no issues
  • Loading branch information
zlav authored Oct 12, 2021
1 parent e6e9b7d commit 7126736
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Spectrometer Changelog

## v2.16.5
- JSON Output for `fossa test --json` when there are no issues. ([#387](https://github.com/fossas/spectrometer/pull/387))

## v2.16.4
- Monorepo: Fix bug with symlink logic mismatch between walker and buildspec uploader. ([#388](https://github.com/fossas/spectrometer/pull/388))

Expand Down
6 changes: 5 additions & 1 deletion src/App/Fossa/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ testMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds outputType overrid
logInfo ""

case issuesCount issues of
0 -> logInfo "Test passed! 0 issues found"
0 -> do
logInfo "Test passed! 0 issues found"
case outputType of
TestOutputJson -> logStdout . decodeUtf8 . Aeson.encode $ issues
TestOutputPretty -> pure ()
n -> do
logError $ "Test failed. Number of issues found: " <> pretty n
if null (issuesIssues issues)
Expand Down
6 changes: 5 additions & 1 deletion src/App/Fossa/VPS/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ testMain (BaseDir basedir) apiOpts logSeverity timeoutSeconds outputType overrid
logSticky ""

case issuesCount issues of
0 -> logInfo "Test passed! 0 issues found"
0 -> do
logInfo "Test passed! 0 issues found"
case outputType of
TestOutputJson -> logStdout . decodeUtf8 . Aeson.encode $ issues
TestOutputPretty -> pure ()
n -> do
logError $ "Test failed. Number of issues found: " <> pretty n
if null (issuesIssues issues)
Expand Down

0 comments on commit 7126736

Please sign in to comment.