Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make flaky tag work with Scalacheck suites #478

Merged
merged 2 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ trait ScalaCheckSuite extends FunSuite {
implicit def unitToProp(unit: Unit): Prop = Prop.passed

override def munitTestTransforms: List[TestTransform] =
super.munitTestTransforms :+ scalaCheckPropTransform
scalaCheckPropTransform +: super.munitTestTransforms
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like the discussions around transform registrations paid off big time. I was a big proponent for side-effecting transforms but that would have been a nightmare to debug for this bug here.


protected def scalaCheckTestParameters = ScalaCheckTest.Parameters.default

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class ScalaCheckFrameworkSuite extends ScalaCheckSuite {
}
}

override def munitFlakyOK: Boolean = true
test("flaky test".flaky) {
forAll { (i: Int) =>
assertEquals(1, 0)
}
}

}

object ScalaCheckFrameworkSuite
Expand Down Expand Up @@ -78,5 +85,6 @@ object ScalaCheckFrameworkSuite
|Falsified after 0 passed tests.
|> ARG_0: -1
|> ARG_0_ORIGINAL: 2147483647
|==> skipped munit.ScalaCheckFrameworkSuite.flaky test - ignoring flaky test failure
|""".stripMargin
)