nunomaduro/termwind

Testing an Artisan command using render()

eleftrik opened this issue · 2 comments

Is it possible to test an Artisan command's console output (via expectsOutput, doesntExpectOutput) which is using, for example, render() function?

Artisan command foo:

...
render('bar'); // even with no styling/HTML
...

Unit PEST:

it('does not show output foo string', function () {
    $this->artisan('foo')
        ->doesntExpectOutput('bar');
});

Apparently, there is no difference between using render('bar') or not: the test always passes.
Am I doing anything wrong?

Thank you

Hey @eleftrik, thanks for the issue, we want to support expectations, but is not yet available, if you want to contribute, feel free to do it.

I will keep this issue open.

Thanks.

@xiCO2k I think we should have a service provider, that automatically injects the command output on the renderUsing function...