Skip to content

Commit

Permalink
add support for "verbosity" flag, disable spinner by default
Browse files Browse the repository at this point in the history
fixes #267
  • Loading branch information
C-Otto committed Nov 17, 2022
1 parent 27c7e5e commit 44f374a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
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
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 @@ -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

0 comments on commit 44f374a

Please sign in to comment.