Skip to content

fix: report dataset provider errors as failing tests#1749

Open
sonalidudhia wants to merge 1 commit into
pestphp:4.xfrom
sonalidudhia:fix/dataset-provider-errors
Open

fix: report dataset provider errors as failing tests#1749
sonalidudhia wants to merge 1 commit into
pestphp:4.xfrom
sonalidudhia:fix/dataset-provider-errors

Conversation

@sonalidudhia

Copy link
Copy Markdown

What

Errors raised while resolving a test's dataset previously crashed the entire run instead of being reported as a normal test failure. This affects:

  • referencing a missing named dataset (e.g. ->with('missing'))
  • a dataset closure that throws during resolution

How

  • The generated data provider now wraps any throwable from DatasetsRepository::get() in a new internal DatasetProviderError.
  • The generated test method detects that single-argument error case and rethrows the original throwable.

Result: the affected test fails cleanly with its real error message and a non-zero exit code, while the rest of the suite keeps running.

Tests

Added tests/Features/DatasetProviderErrors.php covering:

  • missing dataset in a single-file run
  • missing dataset alongside a passing test
  • a throwing dataset closure

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.
@sonalidudhia sonalidudhia marked this pull request as ready for review July 8, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant