ApprovalTests.Net
ApprovalTests.Net copied to clipboard
.NET Core 3.1 with xUnit 2.4.1 - ApprovalTests is not detecting the proper source path
Hello,
I have created a new xUnit .NET Core 3.1 project with the ApprovalTests v.5.4.5 library, I always get the following exception:
System.Exception :
ApprovalTests is not detecting the proper source path
This is probably because you're missing the following
line in your .csproj file:
<DebugType>full</DebugType>
in the
<Project>
<PropertyGroup>
element.
Solution:
a) Add <DebugType>full</DebugType> to your .csproj file.
b) OR Build->Advanced->DebugInfo to Full
Stack Trace:
StackTraceParser.get_SourcePath() line 80
UnitTestFrameworkNamer.get_SourcePath() line 28
FileApprover.Approve() line 27
Approver.Verify(IApprovalApprover approver, IApprovalFailureReporter reporter) line 7
Approvals.Verify(IApprovalApprover approver, IApprovalFailureReporter reporter) line 71
Approvals.Verify(IApprovalWriter writer, IApprovalNamer namer, IApprovalFailureReporter reporter) line 52
Approvals.Verify(IApprovalWriter writer) line 124
Approvals.VerifyWithExtension(String text, String fileExtensionWithDot, Func`2 scrubber) line 189
Approvals.Verify(String text, Func`2 scrubber) line 176
NameJoinerTests.JoinNames() line 19
I added the DebugType in the solution file. Unfortunately did not help.
That would be the unit test:
using ApprovalTests;
using ApprovalTests.Reporters;
using Xunit;
namespace ApprovalTestsSample
{
public class NameJoinerTests
{
[Fact]
[UseReporter(typeof(DiffReporter))]
public void JoinNames()
{
var nameJoiner = new NameJoiner();
string result = nameJoiner.Join("Gregor", "Biswanger");
Approvals.Verify(result);
}
}
}
Maybe same problem (and workaround) as with my open Issue: https://github.com/approvals/ApprovalTests.Net/issues/449
This project is not being actively maintained. Instead consider using Verify. See Migrating from ApprovalTests for more information.