mirror of
https://github.com/pestphp/pest.git
synced 2026-07-22 01:20:03 +02:00
fix: report dataset provider errors as failing tests (#1749)
Errors raised while resolving a test's dataset (missing named dataset, throwing dataset closure) previously crashed the whole run. Now the data provider catches them, wraps them in a DatasetProviderError, and the test method rethrows the original throwable so the affected test fails cleanly with a non-zero exit code while other tests keep running.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class DatasetProviderError extends RuntimeException
|
||||
{
|
||||
public function __construct(Throwable $previous)
|
||||
{
|
||||
parent::__construct($previous->getMessage(), (int) $previous->getCode(), $previous);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user