diff --git a/packages/bruno-cli/src/commands/run.js b/packages/bruno-cli/src/commands/run.js
index e0cb460e7..7f762eb78 100644
--- a/packages/bruno-cli/src/commands/run.js
+++ b/packages/bruno-cli/src/commands/run.js
@@ -17,6 +17,7 @@ const { parseDotEnv, parseEnvironment } = require('@usebruno/filestore');
const constants = require('../constants');
const { findItemInCollection, createCollectionJsonFromPathname, getCallStack, FORMAT_CONFIG } = require('../utils/collection');
const { hasExecutableTestInScript } = require('../utils/request');
+const { createSkippedFileResults } = require('../utils/run');
const command = 'run [paths...]';
const desc = 'Run one or more requests/folders';
@@ -661,7 +662,8 @@ const handler = async function (argv) {
...result,
runDuration: process.hrtime(start)[0] + process.hrtime(start)[1] / 1e9,
suitename: pathname.replace('.bru', ''),
- name
+ name,
+ path: result.test?.filename || path.relative(collectionPath, pathname)
});
if (reporterSkipAllHeaders) {
@@ -734,6 +736,9 @@ const handler = async function (argv) {
}
}
+ const skippedFileResults = createSkippedFileResults(global.brunoSkippedFiles || [], collectionPath);
+ results.push(...skippedFileResults);
+
const summary = printRunSummary(results);
const runCompletionTime = new Date().toISOString();
const totalTime = results.reduce((acc, res) => acc + res.response.responseTime, 0);
diff --git a/packages/bruno-cli/src/utils/run.js b/packages/bruno-cli/src/utils/run.js
new file mode 100644
index 000000000..44d68f027
--- /dev/null
+++ b/packages/bruno-cli/src/utils/run.js
@@ -0,0 +1,40 @@
+const path = require('path');
+const { stripExtension } = require('./filesystem');
+
+const createSkippedFileResults = (skippedFiles, collectionPath) => {
+ return skippedFiles.map((skippedFile) => {
+ const relativePath = path.relative(collectionPath, skippedFile.path);
+ return {
+ test: {
+ filename: relativePath
+ },
+ request: {
+ method: null,
+ url: null,
+ headers: null,
+ data: null
+ },
+ response: {
+ status: 'skipped',
+ statusText: skippedFile.error,
+ data: null,
+ responseTime: 0
+ },
+ error: skippedFile.error,
+ status: 'skipped',
+ skipped: true,
+ assertionResults: [],
+ testResults: [],
+ preRequestTestResults: [],
+ postResponseTestResults: [],
+ runDuration: 0,
+ suitename: stripExtension(relativePath),
+ name: path.basename(skippedFile.path),
+ path: relativePath
+ };
+ });
+};
+
+module.exports = {
+ createSkippedFileResults
+};
diff --git a/packages/bruno-cli/tests/runner/report-metadata.spec.js b/packages/bruno-cli/tests/runner/report-metadata.spec.js
index 2db861b35..550a592b6 100644
--- a/packages/bruno-cli/tests/runner/report-metadata.spec.js
+++ b/packages/bruno-cli/tests/runner/report-metadata.spec.js
@@ -49,4 +49,65 @@ describe('HTML Report Generation', () => {
expect(htmlString).toContain('{{ totalDataReceived }}');
expect(htmlString).toContain('{{ averageResponseTime }}');
});
+
+ it('should include skipped requests with parsing errors in the HTML report', async () => {
+ const mockResults = [
+ {
+ iterationIndex: 0,
+ results: [
+ {
+ test: {
+ filename: 'invalid-request.bru'
+ },
+ request: {
+ method: null,
+ url: null,
+ headers: null,
+ data: null
+ },
+ response: {
+ status: 'skipped',
+ statusText: 'Unexpected token',
+ data: null,
+ responseTime: 0
+ },
+ error: 'Unexpected token',
+ status: 'skipped',
+ skipped: true,
+ assertionResults: [],
+ testResults: [],
+ preRequestTestResults: [],
+ postResponseTestResults: [],
+ name: 'invalid-request.bru',
+ path: 'invalid-request.bru',
+ runDuration: 0
+ }
+ ],
+ summary: {
+ totalRequests: 1,
+ passedRequests: 0,
+ failedRequests: 0,
+ errorRequests: 0,
+ skippedRequests: 1,
+ totalAssertions: 0,
+ passedAssertions: 0,
+ failedAssertions: 0,
+ totalTests: 0,
+ passedTests: 0,
+ failedTests: 0
+ }
+ }
+ ];
+
+ const htmlString = generateHtmlReport({
+ runnerResults: mockResults,
+ version: 'usebruno v1.16.0',
+ environment: null,
+ runCompletionTime: '2024-01-15T14:30:45.123Z'
+ });
+
+ expect(htmlString).toContain('Request Skipped');
+ expect(htmlString).toContain('summarySkippedRequests');
+ expect(htmlString).toContain('result.response.status === \'skipped\'');
+ });
});
diff --git a/packages/bruno-common/src/runner/reports/html/template.ts b/packages/bruno-common/src/runner/reports/html/template.ts
index ca49cb337..bbc87331f 100644
--- a/packages/bruno-common/src/runner/reports/html/template.ts
+++ b/packages/bruno-common/src/runner/reports/html/template.ts
@@ -310,7 +310,7 @@ export const htmlTemplateString = (resutsJsonString: string) => `
:bordered="false"
>
- {{result.path}} - {{result.response.status === 'skipped' ? 'Request Skipped' : (totalPassed + '/' + total + ' Passed')}} {{hasError ? " - (request failed)" : "" }}
+ {{result.path}} - {{result.response.status === 'skipped' ? 'Request Skipped' : (totalPassed + '/' + total + ' Passed')}} {{hasError && result.response.status !== 'skipped' ? " - (request failed)" : "" }}
@@ -365,7 +365,7 @@ export const htmlTemplateString = (resutsJsonString: string) => `
-
+
{{result.error}}
@@ -757,7 +757,7 @@ export const htmlTemplateString = (resutsJsonString: string) => `
return (props?.result?.testResults?.length || 0) + (props?.result?.assertionResults?.length || 0);
});
- const hasError = computed(() => !!props?.result?.error || props?.result?.status === 'error');
+ const hasError = computed(() => !!props?.result?.error || props?.result?.status === 'error' || (props?.result?.response?.status === 'skipped' && props?.result?.error));
const hasFailure = computed(() => total.value !== totalPassed.value);
const testDuration = computed(() => Math.round(props?.result?.runDuration * 1000) + ' ms');
const resultTitle = computed(() => props?.result?.path + ' ' + props?.result?.response?.status + ' ' + props?.result?.response?.statusText);