Skip to content
Merged
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
1 change: 1 addition & 0 deletions TUnit.Core/TUnitActivitySource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal static class TUnitActivitySource
internal const string SpanTestAssembly = "test assembly";
internal const string SpanTestSuite = "test suite";
internal const string SpanTestCase = "test case";
internal const string SpanTestBody = "test body";

// Tag keys used across init/dispose spans and the HTML report.
internal const string TagTestId = "tunit.test.id";
Expand Down
9 changes: 8 additions & 1 deletion TUnit.Engine/Reporters/Html/HtmlReportGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,15 @@ function gd(s) {
function renderTrace(tid, rootSpanId) {
const allSpans = spansByTrace[tid];
if (!allSpans || !allSpans.length) return '';
const sp = getDescendants(allSpans, rootSpanId);
let sp = getDescendants(allSpans, rootSpanId);
if (!sp.length) return '';
// 'test body' must match TUnitActivitySource.SpanTestBody in C#
const directChildren = sp.filter(s => s.parentSpanId === rootSpanId);
if (directChildren.length === 1 && directChildren[0].name === 'test body') {
const tbId = directChildren[0].spanId;
sp = sp.filter(s => s.spanId !== tbId).map(s => s.parentSpanId === tbId ? {...s, parentSpanId: rootSpanId} : s);
}
if (sp.length <= 1) return '';
// Include the parent suite span so the test bar is shown relative to the class duration
const root = bySpanId[rootSpanId];
if (root && root.parentSpanId && bySpanId[root.parentSpanId]) {
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Engine/TestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ await _eventReceiverOrchestrator.InvokeFirstTestInClassEventReceiversAsync(
if (TUnitActivitySource.Source.HasListeners())
{
testBodyActivity = TUnitActivitySource.StartActivity(
"test body",
TUnitActivitySource.SpanTestBody,
ActivityKind.Internal,
executableTest.Context.Activity?.Context ?? default);
}
Expand Down
Loading