Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auto-detect-newman.html
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ <h1>Swagger Coverage Report</h1>
&#128262; <!-- flashlight icon -->
</button>
<div class="meta-info">
<p><strong>Timestamp:</strong> 9/18/2025, 2:32:58 PM</p>
<p><strong>Timestamp:</strong> 9/21/2025, 7:49:24 PM</p>
<p><strong>API Spec:</strong> Test API</p>

<p><strong>Postman Collection:</strong> Test Newman Collection</p>
Expand Down
25 changes: 23 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { loadAndParseSpec, extractOperationsFromSpec } = require("./lib/swagger")
const { loadPostmanCollection, extractRequestsFromPostman } = require("./lib/postman");
const { loadNewmanReport, extractRequestsFromNewman } = require("./lib/newman");
const { matchOperationsDetailed } = require("./lib/match");
const { generateHtmlReport } = require("./lib/report");
const { generateHtmlReport, generateGraphHtmlReport } = require("./lib/report");
const { loadExcelSpec } = require("./lib/excel");
const { loadAndParseProto, extractOperationsFromProto, isProtoFile } = require("./lib/grpc");
const { loadAndParseGraphQL, extractOperationsFromGraphQL, isGraphQLFile } = require("./lib/graphql");
Expand All @@ -29,9 +29,10 @@ program
.option("--strict-body", "Enable strict validation of requestBody (JSON)")
.option("--output <file>", "HTML report output file", "coverage-report.html")
.option("--newman", "Treat input file as Newman run report instead of Postman collection")
.option("--graph-report", "Generate a separate graph schema HTML report showing API test coverage with nodes and edges")
.action(async (apiFiles, postmanFile, options) => {
try {
const { verbose, strictQuery, strictBody, output, newman } = options;
const { verbose, strictQuery, strictBody, output, newman, graphReport } = options;

// Parse comma-separated API files
const files = apiFiles.includes(',') ?
Expand Down Expand Up @@ -217,6 +218,26 @@ program

fs.writeFileSync(path.resolve(output), html, "utf8");
console.log(`\nHTML report saved to: ${output}`);

// 8. Generate graph report if requested
if (graphReport) {
const graphOutputFile = output.replace(/\.html?$/i, '-graph.html');
const graphHtml = generateGraphHtmlReport({
coverage,
coverageItems,
meta: {
timestamp: new Date().toLocaleString(),
specName: combinedSpecName,
postmanCollectionName: collectionName,
undocumentedRequests,
apiCount: files.length,
apiNames: allSpecNames
},
});

fs.writeFileSync(path.resolve(graphOutputFile), graphHtml, "utf8");
console.log(`Graph report saved to: ${graphOutputFile}`);
}
} catch (err) {
console.error("Error:", err.message);
process.exit(1);
Expand Down
Loading