Skip to content

Commit ddd6848

Browse files
authored
fix: tests (#1226)
* fix: parsing error test * fix: SBT scala.js test * fix: metals test * fix: SBT scala.js timeout * revert timeout changes * cache test * Revert "cache test" This reverts commit 587482c. * scala.js test * Revert "scala.js test" This reverts commit e2760f2. * fix scala.js? * Revert "fix scala.js?" This reverts commit ef0e022. * fix: metals test? * debug * fix: scala.js test There was an error with artifact version suffix. It was searching for sjs1_2.13 instead of sjs1_2.13.18.
1 parent afc6ede commit ddd6848

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

api/src/main/scala/org/scastie/api/ScalaTarget.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ case class Js(scalaVersion: String, scalaJsVersion: String) extends SbtScalaTarg
164164
case v if v.startsWith("3") =>
165165
renderLibWithSuffix(lib, s"${scalaJsVersionPrefix}_3.1.3")
166166
case v if v.startsWith("2.13") =>
167-
renderLibWithSuffix(lib, s"${scalaJsVersionPrefix}_2.13")
167+
renderLibWithSuffix(lib, s"${scalaJsVersionPrefix}_${BuildInfo.latest213}")
168168
case v if v.startsWith("2.12") =>
169-
renderLibWithSuffix(lib, s"${scalaJsVersionPrefix}_2.12")
169+
renderLibWithSuffix(lib, s"${scalaJsVersionPrefix}_${BuildInfo.latest212}")
170170
case _ => renderSbtCross(lib)
171171
}
172172
case _ => renderSbtCross(lib)

metals-runner/src/main/scala/org/scastie/metals/MetalsDispatcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class MetalsDispatcher(cache: Cache[IO, ScastieMetalsOptions, ScastiePresentatio
9393
compiler <- EitherT.right(
9494
cache.getOrUpdateReleasable(configuration) {
9595
initializeCompiler(configuration, mtags).map: newPC =>
96-
Releasable(newPC, IO(newPC.shutdown()))
96+
Releasable(newPC, newPC.shutdown())
9797
})
9898
yield compiler
9999
.value

metals-runner/src/main/scala/org/scastie/metals/ScastiePresentationCompiler.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@ case class OldScastiePresentationCompiler(underlyingPC: PresentationCompiler) ex
113113
private val logger = LoggerFactory.getLogger(getClass)
114114

115115
def inifiniteCompilationDetection[Input, Output](task: IO[Output])(input: Input): IO[Output] =
116-
task.timeout(30.seconds).onError { case _: TimeoutException =>
117-
IO.pure {
118-
logger.error("FATAL ERROR: Timeout while computing completions, possible inifinite compilation")
119-
logger.error(input.toString)
120-
}
116+
task.timeout(30.seconds).onError { case e: Throwable =>
117+
e match
118+
case _: TimeoutException =>
119+
IO.pure {
120+
logger.error("FATAL ERROR: Timeout while computing completions, possible inifinite compilation")
121+
logger.error(input.toString)
122+
}
123+
case _ =>
124+
IO.unit
121125
}
122126

123127
def complete(offsetParams: ScastieOffsetParams): IO[ScalaCompletionList] =

metals-runner/src/test/scala/org/scastie/metals/MetalsDispatcherTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MetalsDispatcherTest extends CatsEffectSuite with Assertions with CatsEffe
2525
None
2626
)
2727

28-
override val munitTimeout = 60.seconds
28+
override val munitTimeout = 120.seconds
2929

3030
test("single thread metals access") {
3131
cache.use { cache =>

scala-cli-runner/src/test/scala/org/scastie/scalacli/ScalaCliRunnerTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class ScalaCliRunnerTest extends TestKit(ActorSystem("ScalaCliRunnerTest")) with
110110
test("report parsing error 2") {
111111
runCode("val x = 1a", allowFailure = true)(
112112
assertCompilationInfo(
113-
assertProblemInfo("Invalid literal number, followed by identifier character", Some(1), Some(10), Some(10))(_)
113+
assertProblemInfo("end of statement expected but identifier found", Some(1), Some(10), Some(11))(_)
114114
)
115115
)
116116
}

0 commit comments

Comments
 (0)