Skip to content

Commit 93d57d3

Browse files
committed
chore: allow handling of special tests
1 parent d5bb6b3 commit 93d57d3

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
plugins {
88
id 'buildlogic.java-application-conventions'
9+
id 'buildlogic.java-special-tests-conventions'
910
}
1011

1112
dependencies {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id 'java'
3+
id 'com.adarshr.test-logger'
4+
}
5+
6+
// See com.diffplug.spotless.tag package for available JUnit 5 @Tag annotations
7+
def special = [
8+
'cliProcess',
9+
'cliProcessNpm',
10+
'cliNative',
11+
'cliNativeNpm'
12+
]
13+
14+
tasks.named('test').configure {
15+
useJUnitPlatform {
16+
excludeTags special as String[]
17+
}
18+
}
19+
20+
special.forEach { tag ->
21+
tasks.register("test${tag.capitalize()}", Test) {
22+
useJUnitPlatform { includeTags tag }
23+
}
24+
}
25+
26+
tasks.register('testAll') {
27+
dependsOn tasks.matching { it.name.startsWith('test') && it.name != 'testAll' }
28+
}
29+
30+
tasks.withType(Test).configureEach {
31+
testLogging.showStandardStreams = true
32+
}

settings.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ plugins {
2525

2626
// https://github.com/diffplug/spotless-changelog/blob/main/README.md
2727
id 'com.diffplug.spotless-changelog' version '3.1.2' apply false
28+
29+
// https://github.com/radarsh/gradle-test-logger-plugin/blob/develop/CHANGELOG.md
30+
id 'com.adarshr.test-logger' version '4.0.0' apply false
2831
}
2932

3033
rootProject.name = 'spotless-cli'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2021-2024 DiffPlug
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.diffplug.spotless.tag;
17+
18+
import java.lang.annotation.Retention;
19+
import java.lang.annotation.Target;
20+
21+
import org.junit.jupiter.api.Tag;
22+
23+
import static java.lang.annotation.ElementType.METHOD;
24+
import static java.lang.annotation.ElementType.TYPE;
25+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
26+
27+
@Target({TYPE, METHOD})
28+
@Retention(RUNTIME)
29+
@Tag("npm")
30+
public @interface NpmTest {}

0 commit comments

Comments
 (0)