mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 08:09:17 +02:00
Introduce "minimal" test reporter (#1563)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,4 +22,5 @@ class CliTestOptions(
|
||||
val overwrite: Boolean = false,
|
||||
val junitAggregateReports: Boolean = false,
|
||||
val junitAggregateSuiteName: String = "pkl-tests",
|
||||
val reporter: TestReporter = TestReporter.SPEC,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.commons.cli
|
||||
|
||||
enum class TestReporter {
|
||||
SPEC,
|
||||
MINIMAL,
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,9 +19,11 @@ import com.github.ajalt.clikt.parameters.groups.OptionGroup
|
||||
import com.github.ajalt.clikt.parameters.options.default
|
||||
import com.github.ajalt.clikt.parameters.options.flag
|
||||
import com.github.ajalt.clikt.parameters.options.option
|
||||
import com.github.ajalt.clikt.parameters.types.enum
|
||||
import com.github.ajalt.clikt.parameters.types.path
|
||||
import java.nio.file.Path
|
||||
import org.pkl.commons.cli.CliTestOptions
|
||||
import org.pkl.commons.cli.TestReporter
|
||||
|
||||
class TestOptions : OptionGroup() {
|
||||
private val junitReportDir: Path? by
|
||||
@@ -51,7 +53,19 @@ class TestOptions : OptionGroup() {
|
||||
private val overwrite: Boolean by
|
||||
option(names = arrayOf("--overwrite"), help = "Force generation of expected examples.").flag()
|
||||
|
||||
private val reporter: TestReporter by
|
||||
option(names = arrayOf("--test-reporter"), help = "Which test reporter to use for CLI output.")
|
||||
.enum<TestReporter> { it.name.lowercase() }
|
||||
.single()
|
||||
.default(TestReporter.SPEC)
|
||||
|
||||
val cliTestOptions: CliTestOptions by lazy {
|
||||
CliTestOptions(junitReportDir, overwrite, junitAggregateReports, junitAggregateSuiteName)
|
||||
CliTestOptions(
|
||||
junitReportDir,
|
||||
overwrite,
|
||||
junitAggregateReports,
|
||||
junitAggregateSuiteName,
|
||||
reporter,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user