Skip to content

Commit c295abc

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

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/main/scala/zio/intellij/project/ZioProjectBuilder.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import org.jetbrains.plugins.scala.extensions._
1616
import org.jetbrains.plugins.scala.project.template.ScalaVersionDownloadingDialog
1717
import org.jetbrains.plugins.scala.project.{ScalaLanguageLevel, Version, Versions}
1818
import org.jetbrains.plugins.scala.util.HttpDownloadUtil
19-
import org.jetbrains.plugins.scala.{ScalaBundle, ScalaVersion, extensions}
19+
import org.jetbrains.plugins.scala.{extensions, ScalaBundle, ScalaVersion}
2020
import org.jetbrains.sbt.project.template.{SComboBox, SbtModuleBuilderBase, ScalaSettingsStepBase}
2121
import org.jetbrains.sbt.{Sbt, SbtBundle}
2222
import zio.intellij.ZioIcon
@@ -47,7 +47,7 @@ private[zio] class ZioProjectBuilder extends SbtModuleBuilderBase {
4747

4848
val hardcodedZioVersions = Versions(ZIO.`latest-ish`.toString, List("1.0.11", "1.0.10", "1.0.9"))
4949

50-
private lazy val indicator = new EmptyProgressIndicator
50+
private lazy val indicator = new EmptyProgressIndicator
5151
private lazy val scalaVersions = ScalaKind.loadVersionsWithProgress(indicator)
5252
private lazy val sbtVersions = SbtKind.loadVersionsWithProgress(indicator)
5353
private lazy val zioVersions = (for {

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

+17-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ 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.{
11+
AbstractTestFramework,
12+
AbstractTestRunConfiguration,
13+
ScalaTestFrameworkConsoleProperties
14+
}
1115

1216
import java.io.PrintStream
1317
import scala.util.control.NoStackTrace
@@ -35,17 +39,26 @@ private[zio] class ZTestFrameworkConsoleProperties(configuration: AbstractTestRu
3539
.get(self)
3640
.asInstanceOf[ServiceMessageVisitor]
3741

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

4044
override def processServiceMessage(message: ServiceMessage, visitor: ServiceMessageVisitor): Unit =
4145
message.visit(testVisitor)
4246

4347
}
4448

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

54+
private val regexFromHellZio2 =
55+
raw"\[1m.\[34m([\s\S]*).\[0m.\[0m.*\[31mwas not equal to.\[0m..\[1m.\[34m([\s\S]*).\[0m.\[0m\s+.\[1m".r
56+
57+
private val regexFromHell = testFramework match {
58+
case _: Zio1TestFramework => regexFromHellZio1
59+
case _: Zio2TestFramework => regexFromHellZio2
60+
}
61+
4962
override def visitTestFailed(testFailed: TestFailed): Unit = {
5063
val details = testFailed.getStacktrace
5164
val tf = regexFromHell

0 commit comments

Comments
 (0)