diff --git a/Changelog.md b/Changelog.md index cfe513d08..c1d7327d3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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)) diff --git a/src/App/Fossa/Test.hs b/src/App/Fossa/Test.hs index 1787a363c..67d7e5fec 100644 --- a/src/App/Fossa/Test.hs +++ b/src/App/Fossa/Test.hs @@ -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) diff --git a/src/App/Fossa/VPS/Test.hs b/src/App/Fossa/VPS/Test.hs index ef632c32f..bef7a29ec 100644 --- a/src/App/Fossa/VPS/Test.hs +++ b/src/App/Fossa/VPS/Test.hs @@ -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)