Skip to content

Commit 31b4cb3

Browse files
committed
Fixed regex to support ZIO 2
1 parent 6766a48 commit 31b4cb3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/main/scala/zio/intellij/testsupport/ZTestFrameworkConsoleProperties.scala

+13-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.intellij.execution.testframework.sm.SMCustomMessagesParsing
77
import com.intellij.execution.testframework.sm.runner.OutputToGeneralTestEventsConverter
88
import com.intellij.util.ReflectionUtil
99
import jetbrains.buildServer.messages.serviceMessages._
10-
import org.jetbrains.plugins.scala.testingSupport.test.{AbstractTestRunConfiguration, ScalaTestFrameworkConsoleProperties}
10+
import org.jetbrains.plugins.scala.testingSupport.test.{AbstractTestFramework, AbstractTestRunConfiguration, ScalaTestFrameworkConsoleProperties}
1111

1212
import java.io.PrintStream
1313
import scala.util.control.NoStackTrace
@@ -35,17 +35,26 @@ private[zio] class ZTestFrameworkConsoleProperties(configuration: AbstractTestRu
3535
.get(self)
3636
.asInstanceOf[ServiceMessageVisitor]
3737

38-
private lazy val testVisitor = new ZTestVisitor(underlyingTestVisitor)
38+
private lazy val testVisitor = new ZTestVisitor(underlyingTestVisitor, configuration.testFramework)
39+
3940

4041
override def processServiceMessage(message: ServiceMessage, visitor: ServiceMessageVisitor): Unit =
4142
message.visit(testVisitor)
4243

4344
}
4445

45-
private class ZTestVisitor(underlying: ServiceMessageVisitor) extends DefaultServiceMessageVisitor {
46-
private val regexFromHell =
46+
private class ZTestVisitor(underlying: ServiceMessageVisitor, testFramework: AbstractTestFramework) extends DefaultServiceMessageVisitor {
47+
private val regexFromHellZio1 =
4748
raw"\[1m.\[34m([\s\S]*).\[0m.\[0m.*\[31mwas not equal to.*\[1m.\[34m([\s\S]*?).\[0m.\[0m".r
4849

50+
private val regexFromHellZio2 =
51+
raw"\[1m.\[34m([\s\S]*).\[0m.\[0m.*\[31mwas not equal to.\[0m..\[1m.\[34m([\s\S]*).\[0m.\[0m\s+.\[1m".r
52+
53+
private val regexFromHell = testFramework match {
54+
case _: Zio1TestFramework => regexFromHellZio1
55+
case _: Zio2TestFramework => regexFromHellZio2
56+
}
57+
4958
override def visitTestFailed(testFailed: TestFailed): Unit = {
5059
val details = testFailed.getStacktrace
5160
val tf = regexFromHell

0 commit comments

Comments
 (0)