Repository navigation
Make the production editor test independent of test order - #24
Merged
Merged
Conversation
Setting the app environment to production turns off runningUnitTests(), so Laravel stops routing prompts through its fakeable fallback. The test only passed because an earlier test had already set the sticky fallback flag; run alone, or reordered as in the mutation job, select() rendered a real prompt with no TTY and threw NonInteractiveValidationException.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The scheduled Mutation score job on
main(c13e7d7, run 38268249858) failed with 1 failed / 538 passed:TuiTest > it persists multiple edits in production with --force-productionthrewNonInteractiveValidationException: Required.fromEditCommand.php:48.Root cause
The test sets
$this->app['env'] = 'production'. That turns offrunningUnitTests(), and Laravel'sConfiguresPromptsonly routes prompts through the fakeable fallback whenrunningUnitTests()is true. With the fallback off,select()renders a real prompt; with no TTY it is non-interactive, returns the empty default, and failsrequiredvalidation.It passed in the ordinary suite only because
Prompt::fallbackWhen()ORs into a static flag, so an earlier TUI test had already switched the fallback on. Reproduced locally:pest tests/Feature/TuiTest.php --filter=force-production </dev/nullfails onmain.Fix
The test enables the fallback itself (
Prompt::fallbackWhen(true)), so it no longer depends on what ran before it. No source change, and the mutation threshold (--min=85) is untouched.Verified locally
main, passes on this branchlaranail-pint --testpassed,phpstan analyse --debugno errorsThe mutation workflow runs on schedule and
workflow_dispatchonly, so it does not run on this PR. No coverage driver is available locally to run--mutate.