Skip to content

Preserve expectations around nested tests - #2378

Open
Boulea7 wants to merge 2 commits into
r-lib:mainfrom
Boulea7:fix/nested-list-reporter-results
Open

Boulea7 wants to merge 2 commits into
r-lib:mainfrom
Boulea7:fix/nested-list-reporter-results

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 2, 2026

Copy link
Copy Markdown

Fixes #2377.

test_dir() relies on ListReporter to decide whether a run failed. Starting a nested test_that() replaced the enclosing test’s pending expectations, so a failure could appear in the reporter output and still leave R CMD check successful.

Keep each file’s enclosing test state until its nested test finishes. Live parallel reporting sends actual test starts to ListReporter and reuses the saved state when it switches between files.

The regression covers expectations before and after multiple nesting levels in serial and live parallel runs, including a collector nested in MultiReporter. I also checked the original example and a minimal package on R 4.6.2. R CMD check now reports the expected error for that package.

This branch has not been deployed

No deployments
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.

A failing expectation before a nested test_that() block does not make test_dir() fail

1 participant