2

I use Visual Studio 2019 and have added ApprovalTests nuget package. Test class is configured with [UseReporter(typeof(DiffReporter))] and approval is done with Approvals.Verify(result)

It works fine except for the file encoding. In VS I get two files opened. But I also get a warning: "These files have different encodings. Left file: Unicode (UTF-8) with signature. Right file: Western European (Windows). You can resolve the difference by saving the right file with the encoding Unicode (UTF-8) with signature."

I can obviously manually change the right file by saving it with different encoding. That will make the comparison accept the result, but I will the have a content with weird looking escaping in both windows. That makes it much less readable. Example: Simple plus sign is exchanged with \u002B

When debugging the code just before the approval I can verify that the result looks good with all characters as I expect them to look. What happens then? My impression is that the ApprovalTests framework forces an encoding that I can not control.

Jakob Lithner
  • 4,225
  • 6
  • 38
  • 59

0 Answers0