File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change
1
+ lazy val validateTestNames = taskKey[Int ](" Validate test naming convention" )
2
+ val inAllTest = ScopeFilter (inAnyProject, inConfigurations(Test ))
3
+ validateTestNames := {
4
+ val testFileFullPath : Seq [Seq [String ]] = definedTestNames.all(inAllTest).value
5
+ val log = streams.value.log
6
+ val invalidTestName = testFileFullPath.flatMap(_.filterNot(_.endsWith(" UnitTest" )))
7
+ val invalidTestNameFormatted = invalidTestName.mkString(" \n " )
8
+ log.error(
9
+ s """ Found unit test files not matching with naming standards. Unit test files must end with UnitTest.scala.
10
+ | Invalid files:
11
+ | ${invalidTestNameFormatted}
12
+ | """ .stripMargin)
13
+ require(invalidTestName.isEmpty, s " Found ${invalidTestName.size} tests that doesn't follow naming convention! " )
14
+ 0
15
+ }
You can’t perform that action at this time.
0 commit comments