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

Do not log by default #1472

Merged
merged 3 commits into from Jan 22, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/Config/ValueProvider/TextLogFileProvider.php
Expand Up @@ -45,8 +45,6 @@
*/
final class TextLogFileProvider
{
public const TEXT_LOG_FILE_NAME = 'infection.log';

private ConsoleHelper $consoleHelper;
private QuestionHelper $questionHelper;

Expand All @@ -59,22 +57,32 @@ public function __construct(ConsoleHelper $consoleHelper, QuestionHelper $questi
/**
* @param string[] $dirsInCurrentDir
*/
public function get(IO $io, array $dirsInCurrentDir): string
public function get(IO $io, array $dirsInCurrentDir): ?string
{
$io->writeln(['']);

$io->writeln([
'',
'Infection may save execution results in a text log for a future review.',
'This can be "infection.log" but we recommend leaving it out for performance reasons.',
'Press <comment><return></comment> to skip additional logging.',
'',
]);

$questionText = $this->consoleHelper->getQuestion(
'Where do you want to store the text log file?',
self::TEXT_LOG_FILE_NAME
''
);

$question = new Question($questionText, self::TEXT_LOG_FILE_NAME);
$question = new Question($questionText, '');
$question->setAutocompleterValues($dirsInCurrentDir);

return $this->questionHelper->ask(
$answer = $this->questionHelper->ask(
$io->getInput(),
$io->getOutput(),
$question
);

return $answer === '' ? null : $answer;
}
}
13 changes: 0 additions & 13 deletions tests/e2e/Configure/infection.json.dist

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Configure/infection.json.test
Expand Up @@ -4,9 +4,6 @@
"src"
]
},
"logs": {
"text": "infection.log"
},
"mutators": {
"@default": true
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ public function test_it_uses_default_value(): void
[]
);

$this->assertSame(TextLogFileProvider::TEXT_LOG_FILE_NAME, $textLogFilePath);
$this->assertNull($textLogFilePath);
}

public function test_it_uses_typed_value(): void
Expand Down