From f479e0d325fe1044667dd0898350d3634266b555 Mon Sep 17 00:00:00 2001 From: Sanjai Kumar <161328623+sanjaikumar-bruno@users.noreply.github.com> Date: Fri, 5 Dec 2025 19:17:06 +0530 Subject: [PATCH] refactor: Rename `runtime` to `runDuration` (#6323) * refactor: Rename 'runtime' to 'runDuration' * revert changes made in report.html --- packages/bruno-cli/src/commands/run.js | 2 +- packages/bruno-cli/src/reporters/junit.js | 12 ++++++------ packages/bruno-cli/tests/reporters/junit.spec.js | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/bruno-cli/src/commands/run.js b/packages/bruno-cli/src/commands/run.js index ce0b6d3dc..72cbdd29d 100644 --- a/packages/bruno-cli/src/commands/run.js +++ b/packages/bruno-cli/src/commands/run.js @@ -575,7 +575,7 @@ const handler = async function (argv) { results.push({ ...result, - runtime: process.hrtime(start)[0] + process.hrtime(start)[1] / 1e9, + runDuration: process.hrtime(start)[0] + process.hrtime(start)[1] / 1e9, suitename: pathname.replace('.bru', ''), name }); diff --git a/packages/bruno-cli/src/reporters/junit.js b/packages/bruno-cli/src/reporters/junit.js index 6f73b3214..df0430381 100644 --- a/packages/bruno-cli/src/reporters/junit.js +++ b/packages/bruno-cli/src/reporters/junit.js @@ -24,7 +24,7 @@ const makeJUnitOutput = async (results, outputPath) => { '@tests': totalTests, '@timestamp': new Date().toISOString().split('Z')[0], '@hostname': os.hostname(), - '@time': result.runtime.toFixed(3), + '@time': result.runDuration.toFixed(3), 'testcase': [] }; @@ -34,7 +34,7 @@ const makeJUnitOutput = async (results, outputPath) => { '@name': `${assertion.lhsExpr} ${assertion.rhsExpr}`, '@status': assertion.status, '@classname': result.request.url, - '@time': (result.runtime / totalTests).toFixed(3) + '@time': (result.runDuration / totalTests).toFixed(3) }; if (assertion.status === 'fail') { @@ -52,7 +52,7 @@ const makeJUnitOutput = async (results, outputPath) => { '@name': test.description, '@status': test.status, '@classname': result.request.url, - '@time': (result.runtime / totalTests).toFixed(3) + '@time': (result.runDuration / totalTests).toFixed(3) }; if (test.status === 'fail') { @@ -70,7 +70,7 @@ const makeJUnitOutput = async (results, outputPath) => { '@name': test.description, '@status': test.status, '@classname': result.request.url, - '@time': (result.runtime / totalTests).toFixed(3) + '@time': (result.runDuration / totalTests).toFixed(3) }; if (test.status === 'fail') { @@ -88,7 +88,7 @@ const makeJUnitOutput = async (results, outputPath) => { '@name': test.description, '@status': test.status, '@classname': result.request.url, - '@time': (result.runtime / totalTests).toFixed(3) + '@time': (result.runDuration / totalTests).toFixed(3) }; if (test.status === 'fail') { @@ -110,7 +110,7 @@ const makeJUnitOutput = async (results, outputPath) => { '@name': 'Test suite has no errors', '@status': 'fail', '@classname': result.request.url, - '@time': result.runtime.toFixed(3), + '@time': result.runDuration.toFixed(3), 'error': [{ '@type': 'error', '@message': result.error }] } ]; diff --git a/packages/bruno-cli/tests/reporters/junit.spec.js b/packages/bruno-cli/tests/reporters/junit.spec.js index 51183e6fa..6c9303d2f 100644 --- a/packages/bruno-cli/tests/reporters/junit.spec.js +++ b/packages/bruno-cli/tests/reporters/junit.spec.js @@ -40,7 +40,7 @@ describe('makeJUnitOutput', () => { error: 'expected 200 to not equal 200' } ], - runtime: 1.2345678 + runDuration: 1.2345678 }, { request: { @@ -62,7 +62,7 @@ describe('makeJUnitOutput', () => { status: 'fail' } ], - runtime: 2.3456789 + runDuration: 2.3456789 } ]; @@ -110,7 +110,7 @@ describe('makeJUnitOutput', () => { status: 'fail' } ], - runtime: 1.2345678, + runDuration: 1.2345678, error: 'timeout of 2000ms exceeded' } ]; @@ -164,7 +164,7 @@ describe('makeJUnitOutput', () => { error: 'expected 200 to equal 404' } ], - runtime: 1.2345678 + runDuration: 1.2345678 } ];