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

add support for "verbosity" flag, disable spinner by default #321

Merged
merged 4 commits into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The expected parameter format in a plugin configuration can be taken from
[PitestPluginExtension](https://github.com/szpak/gradle-pitest-plugin/blob/master/src/main/groovy/info/solidsoft/gradle/pitest/PitestPluginExtension.groovy).

To make life easier `taskClasspath`, `mutableCodePaths`, `sourceDirs`, `reportDir` and `pitestVersion` are
automatically set by a plugin. In addition `sourceDirs`, `reportDir` and `pitestVersion` can be overridden by an user.
automatically set by a plugin. In addition `sourceDirs`, `reportDir` and `pitestVersion` can be overridden by a user.

There are a few parameters specific for Gradle plugin:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class PitestPlugin implements Plugin<Project> {
extension.mainSourceSets.set([javaSourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)])
extension.fileExtensionsToFilter.set(DEFAULT_FILE_EXTENSIONS_TO_FILTER_FROM_CLASSPATH)
extension.useClasspathFile.set(false)
extension.verbosity.set("NO_SPINNER")
}

private void failWithMeaningfulErrorMessageOnUnsupportedConfigurationInRootProjectBuildScript() {
Expand Down Expand Up @@ -155,6 +156,7 @@ class PitestPlugin implements Plugin<Project> {
task.excludedTestClasses.set(extension.excludedTestClasses)
task.avoidCallsTo.set(extension.avoidCallsTo)
task.verbose.set(extension.verbose)
task.verbosity.set(extension.verbosity)
task.timeoutFactor.set(extension.timeoutFactor)
task.timeoutConstInMillis.set(extension.timeoutConstInMillis)
task.childProcessJvmArgs.set(extension.jvmArgs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class PitestPluginExtension {
final SetProperty<String> excludedTestClasses
final SetProperty<String> avoidCallsTo
final Property<Boolean> verbose
final Property<String> verbosity
C-Otto marked this conversation as resolved.
Show resolved Hide resolved
final Property<BigDecimal> timeoutFactor
final Property<Integer> timeoutConstInMillis
/**
Expand Down Expand Up @@ -237,6 +238,7 @@ class PitestPluginExtension {
excludedTestClasses = nullSetPropertyOf(p, String)
avoidCallsTo = nullSetPropertyOf(p, String)
verbose = of.property(Boolean)
verbosity = of.property(String)
timeoutFactor = of.property(BigDecimal)
timeoutConstInMillis = of.property(Integer)
jvmArgs = nullListPropertyOf(p, String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class PitestTask extends JavaExec {
@Optional
final Property<Boolean> verbose

@Input
@Optional
final Property<String> verbosity

@Input
@Optional
final Property<BigDecimal> timeoutFactor
Expand Down Expand Up @@ -261,6 +265,7 @@ class PitestTask extends JavaExec {
excludedTestClasses = of.setProperty(String)
avoidCallsTo = of.setProperty(String)
verbose = of.property(Boolean)
verbosity = of.property(String)
timeoutFactor = of.property(BigDecimal)
timeoutConstInMillis = of.property(Integer)
childProcessJvmArgs = of.listProperty(String)
Expand Down Expand Up @@ -350,6 +355,7 @@ class PitestTask extends JavaExec {
map['excludedTestClasses'] = optionalCollectionAsString(excludedTestClasses)
map['avoidCallsTo'] = optionalCollectionAsString(avoidCallsTo)
map['verbose'] = optionalPropertyAsString(verbose)
map['verbosity'] = optionalPropertyAsString(verbosity)
map['timeoutFactor'] = optionalPropertyAsString(timeoutFactor)
map['timeoutConst'] = optionalPropertyAsString(timeoutConstInMillis)
map['jvmArgs'] = optionalCollectionAsString(childProcessJvmArgs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class PitestTaskConfigurationSpec extends BasicProjectBuilderSpec implements Wit
void "should not pass features configuration to PIT if not set in configuration or via option"() {
//Intentional duplication with generic parametrized tests to emphasis requirement
expect:
task.taskArgumentMap()['featues'] == null
task.taskArgumentMap()['features'] == null
szpak marked this conversation as resolved.
Show resolved Hide resolved
}

void "should not pass to PIT parameter '#paramName' by default if not set explicitly"() {
Expand All @@ -124,6 +124,19 @@ class PitestTaskConfigurationSpec extends BasicProjectBuilderSpec implements Wit
paramName << PIT_PARAMETERS_NAMES_NOT_SET_BY_DEFAULT
}

void "should pass to PIT parameter 'verbosity' by default if not set explicitly"() {
expect:
task.taskArgumentMap().containsKey('verbosity')
task.taskArgumentMap().get('verbosity').is('NO_SPINNER')
}

void "should pass to PIT parameter 'verbosity' if set explicitly"() {
given:
project.pitest.verbosity = 'QUIET_WITH_PROGRESS'
expect:
task.taskArgumentMap().get('verbosity').is('QUIET_WITH_PROGRESS')
}

//TODO: Run PIT with those values to detect removed properties and typos
void "should pass plugin configuration (#configParamName) from Gradle to PIT"() {
given:
Expand Down