approvals/ApprovalTests.Net

Commands generated by AllFailingTestsClipboardReporter only works on Windows

claremacrae opened this issue · 5 comments

Steps to reproduce:

On Mac or Linux...

  1. Add this to your ApprovalTests.Config.cs:
    [assembly: UseReporter(typeof(AllFailingTestsClipboardReporter))]
  2. Make some approval tests fail
  3. Paste the clipboard on to a console window...

Expected behaviour:
*.approved.* are updated, for the failing tests

Actual behaviour:
a bunch of errors command not found: cmd

This looks to be the cause:

return $"cmd /c move /Y \"{received}\" \"{approved}\"";

I see this was already logged in #437 - this ticket answers the question there about what the problem was, I think.

The simplest fix would be to change cmd /c move /Y to cp if not on Windows...

There are complications if the user has aliased cp to cp -i - to force a prompt, but I'd prefer to start with a solution that works for many users, than wait for a perfect one!

Or - having read the following - use \cp instead, which will bypass any alias (and has been in my muscle memory for \rm for many years, so I know it works well...

https://unix.stackexchange.com/a/146442/186988

@claremacrae can u try 5.4.6

@claremacrae can u try 5.4.6

Perfect - thanks @SimonCropp !

@SimonCropp the only weird thing is that this doesn't show up in the releases page which thinks that 5.4.4 was the last release....