Skip to content

Commit e7079c7

Browse files
authored
Fix tests not showing exceptions (#219)
1 parent 7897564 commit e7079c7

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

tests/Feature/Sensors/UserSensorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ public function test_it_gracefully_handles_exceptions_while_resolving_user_ids()
251251

252252
public function test_it_does_not_actively_resolve_guards(): void
253253
{
254+
$this->fakeIngest();
254255
Route::get('/test', fn () => 'ok');
255256

256257
$response = $this->get('/test');

tests/TestCase.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use function array_combine;
2828
use function array_intersect_key;
2929
use function collect;
30+
use function dd;
3031
use function env;
3132
use function fopen;
3233
use function method_exists;
@@ -47,11 +48,12 @@ protected function setUp(): void
4748
{
4849
$_ENV['APP_BASE_PATH'] = realpath(__DIR__.'/../workbench/').'/';
4950

51+
Nightwatch::handleUnrecoverableExceptionsUsing(fn ($e) => dd($e));
52+
5053
parent::setUp();
5154

5255
Http::preventStrayRequests();
5356

54-
Nightwatch::handleUnrecoverableExceptionsUsing(fn ($e) => throw $e);
5557
Compatibility::$context = [];
5658

5759
$this->core = $this->app->make(Core::class);

tests/Unit/Hooks/GuzzleMiddlewareTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ class GuzzleMiddlewareTest extends TestCase
1414
public function test_it_gracefully_handles_exceptions_in_the_before_middleware(): void
1515
{
1616
$exceptions = [];
17-
$this->core->sensor->exceptionSensor = function ($e) use (&$exceptions): void {
17+
$this->core->sensor->exceptionSensor = function ($e) use (&$exceptions): array {
1818
$exceptions[] = $e;
19+
20+
return [];
1921
};
2022
$thrownInMicrotimeResolver = false;
2123
$this->core->clock->microtimeResolver = function () use (&$thrownInMicrotimeResolver): float {

tests/Unit/SamplingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function test_it_samples_on_exception(): void
224224
{
225225
$ingest = $this->fakeIngest();
226226
$this->core->config['sampling']['requests'] = 0;
227-
$this->core->sensor->exceptionSensor = fn () => null;
227+
$this->core->sensor->exceptionSensor = fn () => [];
228228
$exception = new RuntimeException('Whoops!');
229229
Route::get('/users', fn () => throw $exception);
230230

0 commit comments

Comments
 (0)