Skip to content

[tests] allow dev's to view test process output locally #1601

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

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<env name="MAKER_SKIP_PANTHER_TEST" value="false" />
<!-- Overrides process timeout when step debugging -->
<!-- <env name="MAKER_PROCESS_TIMEOUT" value="null" /> -->
<!-- Dump the CLI output for a test runner process immediately after running a test -->
<!-- You should only set this to true when you need to debug the actual output of a maker command within a test -->
<!-- <env name="MAKER_TEST_DUMP_OUTPUT" value="false" /> -->
</php>

<testsuites>
Expand Down
11 changes: 10 additions & 1 deletion src/Test/MakerTestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ public function runMaker(array $inputs, string $argumentsString = '', bool $allo
{
$this->executedMakerProcess = $this->environment->runMaker($inputs, $argumentsString, $allowedToFail, $envVars);

return $this->executedMakerProcess->getOutput();
$output = $this->executedMakerProcess->getOutput();

// Allows for debugging the actual CLI output from within a test process. E.g. Manually viewing the output of the
// `make:voter` command that was run within the MakeVoterTest from your local command line.
// You should never use this in CI unless you know what you're doing - resource intensive.
if ('true' === getenv('MAKER_TEST_DUMP_OUTPUT')) {
dump(['Maker Process Output' => $output, 'Maker Process Error Output' => $this->executedMakerProcess->getErrorOutput()]);
}

return $output;
}

/**
Expand Down
Loading