Skip to content

Commit e0ff2f3

Browse files
committed
add hidden option for disable checking TRX producer assembly
1 parent d815519 commit e0ff2f3

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/Smdn.Extensions.Mtp.LiquidTestReports/Smdn.Extensions.Mtp.LiquidTestReports/LiquidTestReportsConverter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ internal sealed class LiquidTestReportsConverter :
5858
private readonly FileInfo? templateFile;
5959
private readonly string? outputFileExtension;
6060
private readonly bool appendGitHubStepSummary;
61+
private readonly bool enableTrxProducerChecking;
6162
private readonly Dictionary<string, string> templateParameters = new(Template.NamingConvention.StringComparer);
6263

6364
private SessionUid? sessionUid;
@@ -83,6 +84,10 @@ IOutputDevice outputDevice
8384
outputFileExtension = null;
8485
appendGitHubStepSummary = false;
8586

87+
enableTrxProducerChecking = !commandLineOptionsService.IsOptionSet(
88+
LiquidTestReportsGeneratorCommandLine.LiquidTestReportsDisableTrxProducerCheckingOptionName
89+
);
90+
8691
if (
8792
commandLineOptionsService.TryGetOptionArgumentList(
8893
LiquidTestReportsGeneratorCommandLine.LiquidTestReportsTemplateFilePathOptionName,
@@ -197,7 +202,7 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
197202
return;
198203

199204
// expects the SessionFileArtifact produced by the assembly 'Microsoft.Testing.Extensions.TrxReport'
200-
if (dataProducer.GetType().Assembly != typeof(TrxReportExtensions).Assembly)
205+
if (enableTrxProducerChecking && dataProducer.GetType().Assembly != typeof(TrxReportExtensions).Assembly)
201206
return;
202207

203208
// expects the SessionFileArtifact that represents a generated TRX file

src/Smdn.Extensions.Mtp.LiquidTestReports/Smdn.Extensions.Mtp.LiquidTestReports/LiquidTestReportsGeneratorCommandLine.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal sealed class LiquidTestReportsGeneratorCommandLine : ICommandLineOption
2121
public const string LiquidTestReportsGitHubStepSummaryOptionName = $"{LiquidTestReportsOptionNameCommonPrefix}github-step-summary";
2222
public const string LiquidTestReportsParameterOptionName = $"{LiquidTestReportsOptionNameCommonPrefix}parameter";
2323

24+
public const string LiquidTestReportsDisableTrxProducerCheckingOptionName = $"{LiquidTestReportsOptionNameCommonPrefix}disable-trx-producer-checking";
25+
2426
/// <inheritdoc />
2527
public string Uid => nameof(LiquidTestReportsGeneratorCommandLine);
2628

@@ -62,6 +64,12 @@ public IReadOnlyCollection<CommandLineOption> GetCommandLineOptions()
6264
arity: ArgumentArity.ZeroOrMore,
6365
isHidden: false
6466
),
67+
new(
68+
name: LiquidTestReportsDisableTrxProducerCheckingOptionName,
69+
description: "Disables checking whether the TRX was generated by Microsoft.Testing.Extensions.TrxReport.",
70+
arity: ArgumentArity.Zero,
71+
isHidden: true
72+
),
6573
];
6674

6775
public Task<ValidationResult> ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions)

0 commit comments

Comments
 (0)