MUnit v1.0.0-M1
First milestone towards MUnit v1.0
This is the first milestone towards releasing MUnit v1.0. The goal of MUnit v1.0 is to fix a few long-standing quirks of the MUnit API that require breaking changes. Check out https://github.com/scalameta/munit/milestone/1 for an overview on what issues are blocking a stable v1.0.0 release (non-milestone).
Fixtures can now be implemented as a toplevel class
Previously, it was only possible to implement Fixture[T]
with inner classes inside FunSuite
. Now, it's possible to implement fixtures with toplevel classes outside of FunSuite
.
Fixture lifecycle methods can now return Future[Unit]
Previously, Fixture[T]
only support synchronous lifecycle methods (beforeAll
, beforeEach
, afterEach
and afterAll
). On the JVM it was possible to use blocking I/O to work around this limitation if you had async fixtures but that was not possible in Scala.js. Now, there is a new munit.FutureFixture[T]
, which supports returning Future[Unit]
from the lifecycle methods. It's also possible to implement fixtures with a custom effect type (like Cats Resource
), see https://scalameta.org/munit/docs/fixtures.html#asynchronous-fixtures-with-custom-effect-type.
⚠️ Breaking changes
This release contains binary breaking changes that require 3rdparty integrations (cats-effect, testcontainers) to recompile their source code. We tried to preserve source compatibility as much as possible by using type aliases.
munit.GenericTest[T]
has been replaced withmunit.Test
. There is a deprecatedmunit.GenericTest
type alias in the package object to preserve source compatibility.munit.GenericBeforeEach[T]
has been replaced withmunit.BeforeEach
. There is a deprecatedmunit.GenericBeforeEach
type alias in the package object to preserve source compatibility.munit.GenericAfterEach[T]
has been replaced withmunit.AfterEach
. There is a deprecatedmunit.GenericAfterEach
type alias in the package object to preserve source compatibility.munit.FunSuite.Fixture
is no longer an inner class, it's now a toplevelmunit.Fixture
class. There is amunit.FunSuite.Fixture
type alias for source compatibility. This alias is not deprecated since it's convenient to not have to explicitlyimport munit.Fixture
inside the body of aFunSuite
class.munit.FunSuite
is now an empty abstract class that extends a new traitmunit.BaseFunSuite
, which includes all the- The method
munit.Test.withBodyMap()
no longer has a type parameter. It's OK to just remove the type parameter, it's no longer used. - The
FunSuite.{afterEach,afterAll}
methods are now evaluated before custom fixtures instead of after custom fixtures. The ordering forbeforeAll
andbeforeEach
is unchanged. The diff below demonstrates an example, assuming you have a fixture namedmyFixture
and a test suite namedMySuite
. In other words,FunSuite.{before*,after*}
methods are now evaluated as a regularFixture[T]
that's always the first element ofmunitFixtures: Seq[Fixture[_]]
.
-- old order
++ new order
MySuite.beforeAll()
myFixture.beforeAll()
MySuite.beforeEach(test-1)
myFixture.beforeEach(test-1)
+ MySuite.afterEach(test-1)
myFixture.afterEach(test-1)
- MySuite.afterEach(test-1)
+ MySuite.afterAll()
myFixture.afterAll()
- MySuite.afterAll()
⚠️ Expect a few more milestone releases with a few more binary breaking changes
We're planning a few minor breaking changes before releasing a stable v1.0.0. Please keep this in mind if you're the maintainer of a 3rdparty integration. We will try to not stay in this milestone for too long.
Merged pull requests
- Bump olafurpg/setup-scala from 12 to 13 by @dependabot in #410
- Use provided
scalaJSVersion
andnativeVersion
by @lolgab in #413 - Update scala-library, scala-reflect to 2.12.15 by @scala-steward in #415
- Update sbt-scalafix to 0.9.31 by @scala-steward in #416
- Update sbt-ci-release to 1.5.9 by @scala-steward in #419
- Update mdoc, sbt-mdoc to 2.2.23 by @scala-steward in #406
- Update sbt-mima-plugin to 1.0.0 by @scala-steward in #405
- Update google-cloud-storage to 1.118.1 by @scala-steward in #398
- Update google-cloud-storage to 2.1.5 by @scala-steward in #421
- More correct string inequality error message by @raboof in #427
- Update sbt-ci-release to 1.5.10 by @scala-steward in #432
- Update sbt-mima-plugin to 1.0.1 by @scala-steward in #428
- Update google-cloud-storage to 2.1.7 by @scala-steward in #426
- Add support for async fixtures by @olafurpg in #430
- Introduce
BaseFunSuite
trait and makeFunSuite
an empty class by @olafurpg in #433
New Contributors
Full Changelog: v0.7.29...v1.0.0-M1