Skip to content

Commit

Permalink
bugfix: Ty to fix flaky Scala CLI suite
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 24, 2023
1 parent 3bc135f commit 80f4efe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class BaseScalaCLIActionSuite(name: String)
expectError,
filterAction,
overrideLayout = layout,
isDiagnosticBased = true,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ abstract class BaseCodeActionLspSuite(
expectError: Boolean = false,
filterAction: CodeAction => Boolean = _ => true,
overrideLayout: Option[String] = None,
isDiagnosticBased: Boolean = false,
)(implicit loc: Location): Unit = {
val scalacOptionsJson =
if (scalacOptions.nonEmpty)
Expand Down Expand Up @@ -88,6 +89,7 @@ abstract class BaseCodeActionLspSuite(
changeFile,
expectError,
filterAction,
isDiagnosticBased,
)
}

Expand All @@ -105,6 +107,7 @@ abstract class BaseCodeActionLspSuite(
changeFile: String => String = identity,
expectError: Boolean = false,
filterAction: CodeAction => Boolean = _ => true,
isDiagnosticBased: Boolean = false,
)(implicit loc: Location): Unit = {
val files = FileLayout.mapFromString(layout)
val (path, input) = files
Expand Down Expand Up @@ -135,6 +138,9 @@ abstract class BaseCodeActionLspSuite(
path,
changeFile(input).replace("<<", "").replace(">>", ""),
)
_ <-
if (isDiagnosticBased) server.didSave(path)(identity)
else Future.successful(())
codeActions <-
server
.assertCodeAction(
Expand Down

0 comments on commit 80f4efe

Please sign in to comment.