Problem summary
- Unit tests, coverage, and vulnerability scans were executed, but Jenkins did not display the results because the JUnit archive and HTML publish steps were commented out.
- Tools involved:
- Trivy (image vulnerability scanner) — produces JSON and can convert it to HTML.
- OWASP Dependency Check — produces XML and HTML reports.
- Istanbul/nyc — produces coverage HTML (lcov-report).
- Test runner — should produce JUnit XML results.
Fixed Jenkinsfile fragment
Below is a consolidated Jenkinsfile fragment with the publish/archive steps uncommented and adjusted. It focuses on Unit Tests, Code Coverage (Istanbul), Build/Push, Trivy scanning, and OWASP Dependency Check publishing.
What Jenkins published
- JUnit test results were archived and shown in the Tests page (Blue Ocean and classic UI).
- Istanbul (nyc) coverage HTML report was published under
coverage/lcov-report/index.html. - Trivy produced a JSON results file that was converted into an HTML report and published.
- OWASP Dependency Check HTML report was published and made available under Artifacts.

Published artifacts (example locations)

--failOnCVSS 9 (or the corresponding publisher threshold), the build only fails on critical CVSS >= 9 — medium findings do not fail the pipeline.

app.js shown at ~80% coverage) with marked statements and branches that need additional tests.
Console excerpt for the Trivy stage showing JSON output and conversion to HTML:
Tips and best practices
- Ensure your test runner produces JUnit XML. Configure the
junitstep to match the test output path (e.g.test-results/**/*.xml). - For HTML publishing, always confirm
reportDirandreportFilespoint to the generated files. UseallowMissing: trueto avoid breaking builds when a report is not generated. - Set security thresholds deliberately. In CI you may want to fail only on high/critical severity and publish informational reports for lower severities.
- Consider archiving both raw JSON/XML outputs and the converted HTML so you can reprocess raw outputs later.
When publishing HTML reports from Jenkins, use
allowMissing: true to avoid failing the build if a report is not produced. Also verify reportDir and reportFiles paths match the files generated by your tools.