Cannot see diff of failing tests
Closed this issue · 1 comments
jackap commented
Hello, I am not able to see the diff of two failing tests.
Errors occurs on:
PHPUnit 8.1.3 by Sebastian Bergmann and contributors. Runtime: PHP 7.2.17
Sample outcome of failing test:
There was 1 failure:
1) TemplateTest::awesomeTest
Failed asserting that two strings are equal.
Snapshots can be updated by passing -d --update-snapshots through PHPUnit's CLI arguments.
Failed asserting that true is false.
/app/tests/TemplateTest.php:100
Expected behaviour:
There was 1 failure:
1) TemplateTest::awesomeTest
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
<title>\n
</title>\n
<style type="text/css" media="all">\n
- @import url('hello');\n
+ @import url('hello-world);\n
</style>\n
</head>\n
<body>\n
Snapshots can be updated by passing -d --update-snapshots through PHPUnit's CLI arguments.
Failed asserting that true is false.
/app/tests/TemplateTest.php:100
A possible solution is to change MatchesSnapshots.php:261
from $newMessage = $exception->getMessage().
to $newMessage = $exception.
jackap commented
Actually I was making a mistake; I was catching another exception inside my test-case
...
try {
$this->assertMatchesSnapshot(...)
}
catch (Throwable $t){...}
Closing the issue