Skip to content

Commit

Permalink
Better snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
robiningelbrecht committed Apr 25, 2023
1 parent 5f0923f commit 27803cb
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 101 deletions.
2 changes: 1 addition & 1 deletion tests/SnapshotTextDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private function applyPregReplace(mixed $data): ?string
'/FAILED(.*?)>(.*?)[ ]{3,}([\S]+)/' => 'FAILED$1>$2 $3',
'/─[\S]*─/' => '───────────────────',
'/([\d]+.[\d]+)%/' => 'SOME-PERCENTAGE',
'/[ ]{3,}\(SOME-PERCENTAGE/' => '(SOME-PERCENTAGE',
'/[ ]{3,}/' => ' ',
];

foreach ($regexes as $regex => $replacement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
Failed asserting that false is true.

at tests/ExampleTests/TestThatHasAllStatusesTest.php:23
19▕
20▕ public function testFail(): void
21▕ {
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 23▕ $this->assertTrue(false);
24▕ }
25▕
26▕ public function testFailWithDiff(): void
27▕ {
19▕
20▕ public function testFail(): void
21▕ {
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 23▕ $this->assertTrue(false);
24▕ }
25▕
26▕ public function testFailWithDiff(): void
27▕ {

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:23

───────────────────
FAILED Tests\ExampleTests\TestThatHasAllStatusesTest > fail with diff
Failed asserting that two arrays are equal.
Array (
- 0 => 'one'
- 1 => 'two'
+ 0 => 'two'
+ 1 => 'one'
- 0 => 'one'
- 1 => 'two'
+ 0 => 'two'
+ 1 => 'one'
)


at tests/ExampleTests/TestThatHasAllStatusesTest.php:31
27▕ {
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
29▕ $this->assertEquals(
30▕ ['one', 'two'],
➜ 31▕ ['two', 'one']
32▕ );
33▕ }
34▕
35▕ public function testError(): void
27▕ {
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
29▕ $this->assertEquals(
30▕ ['one', 'two'],
➜ 31▕ ['two', 'one']
32▕ );
33▕ }
34▕
35▕ public function testError(): void

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:31

Expand All @@ -46,18 +46,18 @@
error

at tests/ExampleTests/TestThatHasAllStatusesTest.php:38
34▕
35▕ public function testError(): void
36▕ {
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 38▕ throw new \Exception('error');
39▕ }
40▕
41▕ public function testRisky(): void
42▕ {
34▕
35▕ public function testError(): void
36▕ {
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 38▕ throw new \Exception('error');
39▕ }
40▕
41▕ public function testRisky(): void
42▕ {

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:38


Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
Duration: DURATION-IN-SECONDS
64 changes: 32 additions & 32 deletions tests/__snapshots__/OutputTest__testPrintCompactMode__1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
Failed asserting that false is true.

at tests/ExampleTests/TestThatHasAllStatusesTest.php:23
19▕
20▕ public function testFail(): void
21▕ {
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 23▕ $this->assertTrue(false);
24▕ }
25▕
26▕ public function testFailWithDiff(): void
27▕ {
19▕
20▕ public function testFail(): void
21▕ {
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 23▕ $this->assertTrue(false);
24▕ }
25▕
26▕ public function testFailWithDiff(): void
27▕ {

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:23

───────────────────
FAILED Tests\ExampleTests\TestThatHasAllStatusesTest > fail with diff
Failed asserting that two arrays are equal.
Array (
- 0 => 'one'
- 1 => 'two'
+ 0 => 'two'
+ 1 => 'one'
- 0 => 'one'
- 1 => 'two'
+ 0 => 'two'
+ 1 => 'one'
)


at tests/ExampleTests/TestThatHasAllStatusesTest.php:31
27▕ {
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
29▕ $this->assertEquals(
30▕ ['one', 'two'],
➜ 31▕ ['two', 'one']
32▕ );
33▕ }
34▕
35▕ public function testError(): void
27▕ {
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
29▕ $this->assertEquals(
30▕ ['one', 'two'],
➜ 31▕ ['two', 'one']
32▕ );
33▕ }
34▕
35▕ public function testError(): void

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:31

Expand All @@ -46,18 +46,18 @@
error

at tests/ExampleTests/TestThatHasAllStatusesTest.php:38
34▕
35▕ public function testError(): void
36▕ {
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 38▕ throw new \Exception('error');
39▕ }
40▕
41▕ public function testRisky(): void
42▕ {
34▕
35▕ public function testError(): void
36▕ {
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 38▕ throw new \Exception('error');
39▕ }
40▕
41▕ public function testRisky(): void
42▕ {

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:38


Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
Duration: DURATION-IN-SECONDS
64 changes: 32 additions & 32 deletions tests/__snapshots__/OutputTest__testPrintWithoutConfig__1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,39 @@
Failed asserting that false is true.

at tests/ExampleTests/TestThatHasAllStatusesTest.php:23
19▕
20▕ public function testFail(): void
21▕ {
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 23▕ $this->assertTrue(false);
24▕ }
25▕
26▕ public function testFailWithDiff(): void
27▕ {
19▕
20▕ public function testFail(): void
21▕ {
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 23▕ $this->assertTrue(false);
24▕ }
25▕
26▕ public function testFailWithDiff(): void
27▕ {

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:23

───────────────────
FAILED Tests\ExampleTests\TestThatHasAllStatusesTest > fail with diff
Failed asserting that two arrays are equal.
Array (
- 0 => 'one'
- 1 => 'two'
+ 0 => 'two'
+ 1 => 'one'
- 0 => 'one'
- 1 => 'two'
+ 0 => 'two'
+ 1 => 'one'
)


at tests/ExampleTests/TestThatHasAllStatusesTest.php:31
27▕ {
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
29▕ $this->assertEquals(
30▕ ['one', 'two'],
➜ 31▕ ['two', 'one']
32▕ );
33▕ }
34▕
35▕ public function testError(): void
27▕ {
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
29▕ $this->assertEquals(
30▕ ['one', 'two'],
➜ 31▕ ['two', 'one']
32▕ );
33▕ }
34▕
35▕ public function testError(): void

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:31

Expand All @@ -57,18 +57,18 @@
error

at tests/ExampleTests/TestThatHasAllStatusesTest.php:38
34▕
35▕ public function testError(): void
36▕ {
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 38▕ throw new \Exception('error');
39▕ }
40▕
41▕ public function testRisky(): void
42▕ {
34▕
35▕ public function testError(): void
36▕ {
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
➜ 38▕ throw new \Exception('error');
39▕ }
40▕
41▕ public function testRisky(): void
42▕ {

1 tests/ExampleTests/TestThatHasAllStatusesTest.php:38


Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
Duration: DURATION-IN-SECONDS
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
✓ do basic assertions DURATION-IN-SECONDS
✓ do some more assertions DURATION-IN-SECONDS

Tests: 2 passed (4 assertions)
Tests: 2 passed (4 assertions)
Duration: DURATION-IN-SECONDS

Top 10 slowest tests:
Tests\ExampleTests\TestThatPassesTest > do basic assertions DURATION-IN-SECONDS
Tests\ExampleTests\TestThatPassesTest > do some more assertions DURATION-IN-SECONDS
───────────────────
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS
4 changes: 2 additions & 2 deletions tests/__snapshots__/OutputTest__testWithProfiling__1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
✓ do basic assertions DURATION-IN-SECONDS
✓ do some more assertions DURATION-IN-SECONDS

Tests: 2 passed (4 assertions)
Tests: 2 passed (4 assertions)
Duration: DURATION-IN-SECONDS

Top 10 slowest tests:
Tests\ExampleTests\TestThatPassesTest > do basic assertions DURATION-IN-SECONDS
Tests\ExampleTests\TestThatPassesTest > do some more assertions DURATION-IN-SECONDS
───────────────────
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS

0 comments on commit 27803cb

Please sign in to comment.