-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Previously, MUnit loaded fixtures even for test suites that had no tests. Now, we skip the entire suite if there are no tests to run.
- Loading branch information
Showing
6 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 16.7.0 |
5 changes: 5 additions & 0 deletions
5
munit/non-jvm/src/main/scala/org/junit/experimental/categories/Category.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.junit.experimental.categories | ||
|
||
import scala.annotation.Annotation | ||
|
||
class Category(classes: Array[Class[_]]) extends Annotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
tests/shared/src/main/scala/munit/Issue497FrameworkSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package munit | ||
|
||
import org.junit.experimental.categories.Category | ||
|
||
class Slow extends Tag("Slow") | ||
|
||
@Category(Array(classOf[Slow])) | ||
class Issue497FrameworkSuite extends FunSuite { | ||
def println(msg: String): Unit = TestingConsole.out.println(msg) | ||
val myFixture: Fixture[Unit] = new Fixture[Unit]("myFixture") { | ||
def apply(): Unit = println("### myFixture apply() ###") | ||
|
||
override def beforeAll(): Unit = { | ||
println("### beforeAll is running ###") | ||
} | ||
|
||
override def afterAll(): Unit = { | ||
println("### afterAll is running ###") | ||
} | ||
} | ||
override def munitFixtures: List[Fixture[Unit]] = List(myFixture) | ||
|
||
test("test1") { | ||
myFixture() | ||
assertEquals(1, 1) | ||
} | ||
|
||
test("test2") { | ||
myFixture() | ||
assertEquals(1, 1) | ||
} | ||
} | ||
|
||
object Issue497FrameworkSuite | ||
extends FrameworkTest( | ||
classOf[Issue497FrameworkSuite], | ||
"""|munit.Issue497FrameworkSuite: | ||
|""".stripMargin, | ||
arguments = Array("--exclude-categories=munit.Slow"), | ||
tags = Set( | ||
OnlyJVM | ||
), | ||
format = StdoutFormat | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters