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
Added debug message section. #610
Conversation
@@ -68,6 +68,18 @@ protected function getLogLines(): array | |||
'Not Covered' | |||
); | |||
|
|||
if (!empty($this->metricsCalculator->getDebugInfo())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File DebugFileLogger
is used for end-to-end tests only. It's not supposed to be used for developers.
We have recently removed it from the documentation, but it hasn't been released yet.
I've added a comment to this class that it's for e2e tests only.
/** | ||
* @var string[] | ||
*/ | ||
private $debugMessage = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure MetricsCalculator
should have debugMessage
array, this looks a bit confusing.
Since the writing to log files is done through subscribers (see MutationTestingResultsLoggerSubscriber
), I would suggest the following:
- Add a initial tests run process to the
InitialTestSuiteStarted()
event's constructor here:
$this->eventDispatcher->dispatch(new InitialTestSuiteStarted()); |
- Subscribe to this
InitialTestSuiteStarted
event inMutationTestingResultsLoggerSubscriber
here
infection/src/Process/Listener/MutationTestingResultsLoggerSubscriber.php
Lines 104 to 109 in 096d7b2
public function getSubscribedEvents(): array | |
{ | |
return [ | |
MutationTestingFinished::class => [$this, 'onMutationTestingFinished'], | |
]; | |
} |
- Extract the process (or command line string) from the
InitialTestSuiteStarted
event and use it inMutationTestingResultsLoggerSubscriber::onMutationTestingFinished()
(which is executed later thanInitialTestSuiteStarted
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be convenient to add this debug info to
infection.log
when--debug
option is used
Also, the command line should be logged only when --debug
option is used, since we are trying to reduce the number of generated information from the log files by default.
Instead of adding it to the infection.log, why not output it to the terminal (when using |
However, I'm ok with adding it to |
This PR:
Fixes #520