Skip to content

Commit

Permalink
allure-xunit: provide default config when allureConfig.json is missing
Browse files Browse the repository at this point in the history
Fixes #381
  • Loading branch information
delatrie committed Oct 3, 2023
1 parent ed4404a commit 73183ef
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Allure.XUnit/AllureXunitConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Allure.Net.Commons;
using System;
using System.Collections.Generic;
using Allure.Net.Commons;
using Allure.Net.Commons.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;

#nullable enable

Expand All @@ -16,9 +15,9 @@ internal class AllureXunitConfiguration : AllureConfiguration

[JsonConstructor]
protected AllureXunitConfiguration(
string title,
string directory,
HashSet<string> links
string? title,
string? directory,
HashSet<string>? links
) : base(title, directory, links)
{
}
Expand All @@ -34,8 +33,6 @@ public static AllureXunitConfiguration CurrentConfig
static AllureXunitConfiguration ParseCurrentConfig() => JObject.Parse(
AllureLifecycle.Instance.JsonConfiguration
)["allure"]?.ToObject<AllureXunitConfiguration>()
?? throw new FileNotFoundException(
"allureConfig.json not found"
);
?? new AllureXunitConfiguration(null, null, null);
}
}

0 comments on commit 73183ef

Please sign in to comment.