Run raw init test calls with --no-interaction so pest cannot hang on a TTY - #46
Merged
Merged
Conversation
Artisan::call inherits interactivity from the suite's stdin, so running
vendor/bin/pest from a real terminal let the init seed and workflow
confirms render into the captured output and block in stream_select
waiting for an answer nobody could see. Piped and CI runs were unaffected
because Symfony marks a non-TTY stdin non-interactive and confirm()
returns its default.
Pin every raw Artisan::call('init') to the non-interactive shape those
tests already assert. Prompt-answering coverage stays on the artisan()
pending-command path, which mocks the question layer and never blocks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
vendor/bin/pesthangs indefinitely when run from an interactive terminal, freezing right afterInfoCommandTest. A stack sample shows PHP blocked instream_selectinside Symfony'sQuestionHelper.The cause:
InitCommandTestruns the command through rawArtisan::call('init'), which inherits interactivity from the suite's stdin. On a TTY, the seed confirm atInitCommand:188(and the workflow confirm at:261) genuinely waits for keyboard input, while the prompt text is swallowed by the buffered output. The suite just looks frozen.This never showed in CI, piped runs, or IDE runners because a non-TTY stdin makes Symfony mark the input non-interactive, so
confirm()returns its default immediately. The hang is not a regression: v1.3.0 with its exact lockfile (symfony/console 7.4.14) reproduces it identically under a pseudo-TTY. It has been latent since the init command landed in 0f14150 and only bites when pest runs bare in a terminal.Fix
Pass
'--no-interaction' => trueat every rawArtisan::call('init')site (34 of them), pinning those tests to the non-interactive shape they already assert. Prompt-answering coverage stays on the$this->artisan()pending-command path, which mocks the question layer and never blocks. A comment at the top of the file records the constraint for future tests.Verification
vendor/bin/pestunder a pseudo-TTY with an open, silent stdin (the exact repro that hung forever): 290 passed in 7.69spint --test: clean🤖 Generated with Claude Code