Skip to content

Commit

Permalink
fail the entire suite in case of a fatal exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuehlke authored and tgodzik committed Aug 28, 2023
1 parent becac1c commit 9cc9c36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions munit/shared/src/main/scala/munit/MUnitRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite)
case ex: StackOverflowError =>
handleNonFatalOrStackOverflow(ex)
case ex =>
suiteAborted = true
notifier.fireTestFailure(new Failure(description, ex))
Future.successful(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ class SwallowedExceptionSuite extends FunSuite {
test("issue-650") {
throw new IllegalAccessError("i am reported")
}

test("should not be executed") {
assertEquals(1, 1)
}
}
object SwallowedExceptionSuite
extends FrameworkTest(
classOf[SwallowedExceptionSuite],
"""|==> failure munit.SwallowedExceptionSuite.issue-51 - i am not reported
|==> failure munit.SwallowedExceptionSuite.issue-650 - i am reported
|==> skipped munit.SwallowedExceptionSuite.should not be executed - Suite has been aborted
|""".stripMargin
)

0 comments on commit 9cc9c36

Please sign in to comment.