mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-15 03:41:28 +00:00
fix: pr review updates
This commit is contained in:
@@ -59,7 +59,7 @@ export default function RunnerResults({ collection }) {
|
||||
pathname: info.pathname,
|
||||
relativePath: getRelativePath(collection.pathname, info.pathname)
|
||||
};
|
||||
if (newItem.status !== 'error' && newItem.status !== 'skipped' && newItem.status !== 'terminated') {
|
||||
if (newItem.status !== 'error' && newItem.status !== 'skipped') {
|
||||
if (newItem.testResults) {
|
||||
const failed = newItem.testResults.filter((result) => result.status === 'fail');
|
||||
newItem.testStatus = failed.length ? 'fail' : 'pass';
|
||||
@@ -174,18 +174,18 @@ export default function RunnerResults({ collection }) {
|
||||
<div className="item-path mt-2">
|
||||
<div className="flex items-center">
|
||||
<span>
|
||||
{item.status !== 'error' && item.testStatus === 'pass' && item.status !== 'skipped' && item.status !== 'terminated' ? (
|
||||
{item.status !== 'error' && item.testStatus === 'pass' && item.status !== 'skipped' ? (
|
||||
<IconCircleCheck className="test-success" size={20} strokeWidth={1.5} />
|
||||
) : (
|
||||
<IconCircleX className="test-failure" size={20} strokeWidth={1.5} />
|
||||
)}
|
||||
</span>
|
||||
<span
|
||||
className={`mr-1 ml-2 ${item.status == 'error' || item.status == 'skipped' || item.status == 'terminated' || item.testStatus == 'fail' ? 'danger' : ''}`}
|
||||
className={`mr-1 ml-2 ${item.status == 'error' || item.status == 'skipped' || item.testStatus == 'fail' ? 'danger' : ''}`}
|
||||
>
|
||||
{item.relativePath}
|
||||
</span>
|
||||
{item.status !== 'error' && item.status !== 'skipped' && item.status !== 'terminated' && item.status !== 'completed' ? (
|
||||
{item.status !== 'error' && item.status !== 'skipped' && item.status !== 'completed' ? (
|
||||
<IconRefresh className="animate-spin ml-1" size={18} strokeWidth={1.5} />
|
||||
) : item.responseReceived?.status ? (
|
||||
<span className="text-xs link cursor-pointer" onClick={() => setSelectedItem(item)}>
|
||||
|
||||
@@ -32,7 +32,7 @@ const CryptoJS = require('crypto-js');
|
||||
const NodeVault = require('node-vault');
|
||||
const { executeQuickJsVmAsync } = require('../sandbox/quickjs');
|
||||
|
||||
const summarizeResults = (results) => {
|
||||
const getResultsSummary = (results) => {
|
||||
const summary = {
|
||||
total: results.length,
|
||||
passed: 0,
|
||||
@@ -47,7 +47,7 @@ const summarizeResults = (results) => {
|
||||
else summary.skipped += 1;
|
||||
});
|
||||
|
||||
return { summary, results };
|
||||
return summary;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,10 +112,32 @@ class TestRuntime {
|
||||
|
||||
bru.getTestResults = async () => {
|
||||
let results = await __brunoTestResults.getResults();
|
||||
return summarizeResults(results);
|
||||
const summary = getResultsSummary(results);
|
||||
return {
|
||||
summary,
|
||||
results: results?.map?.(r => ({
|
||||
status: r?.status,
|
||||
description: r?.description,
|
||||
expected: r?.expected,
|
||||
actual: r?.actual,
|
||||
error: r?.error
|
||||
}))
|
||||
};
|
||||
}
|
||||
bru.getAssertionResults = async () => {
|
||||
return summarizeResults(assertionResults);
|
||||
let results = assertionResults;
|
||||
const summary = getResultsSummary(results);
|
||||
return {
|
||||
summary,
|
||||
results: results?.map?.(r => ({
|
||||
status: r?.status,
|
||||
lhsExpr: r?.lhsExpr,
|
||||
rhsExpr: r?.rhsExpr,
|
||||
operator: r?.operator,
|
||||
rhsOperand: r?.rhsOperand,
|
||||
error: r?.error
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
const context = {
|
||||
|
||||
Reference in New Issue
Block a user