Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved console testing #37

Merged
merged 7 commits into from
Oct 8, 2024
Merged

Improved console testing #37

merged 7 commits into from
Oct 8, 2024

Conversation

markhuot
Copy link
Owner

@markhuot markhuot commented Oct 8, 2024

Improves console testing with IO filters so console output isn't printed to the Pest screen but can still be queried/asserted against.

This allows you to do something like this,

it('executes console commands')
    ->console(PestController::class, 'internal')
    ->assertSuccesful()
    ->assertSee('stdout')
    ->assertSee('stderr')
    ->assertDontSee('missing');

it('gets stdout and stderr', function () {
    $response = $this->console(PestController::class, 'internal');

    expect($response->exitCode)->toBe(0);
    expect($response->stdout)->toContain('stdout');
    expect($response->stderr)->toContain('stderr');
});

@markhuot markhuot merged commit 6c98272 into main Oct 8, 2024
9 checks passed
@markhuot markhuot deleted the console-testing branch October 8, 2024 19:40
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