Skip to content

Releases: typelevel/weaver-test

v0.11.3

08 Dec 11:50
a4b4d88

Choose a tag to compare

What's Changed

This release contains a new matchOrFailFast utility. You can see an example of it in the expectations guide.

API changes

Updates

  • Update scala-library, scala-reflect to 2.13.18 by @typelevel-steward[bot] in #258

Behind the scenes

  • Update sbt-snapshot4s, snapshot4s-core to 0.2.4 by @typelevel-steward[bot] in #260
  • Update sbt-typelevel, sbt-typelevel-site to 0.8.3 by @typelevel-steward[bot] in #256

New Contributors

Full Changelog: v0.11.2...v0.11.3

v0.11.2

21 Nov 12:18
0b05439

Choose a tag to compare

What's Changed

This release contains a bugfix for test-specific scalacheck config being ignored.

Bug fixes

Full Changelog: v0.11.1...v0.11.2

v0.11.1

13 Nov 14:08
21a16b3

Choose a tag to compare

What's Changed

This release contains a fixes a bug in the ignore logic for property tests.

Bug fixes

Behind the scenes

  • Correct order of expected and found values in docs. by @zainab-ali in #253

Full Changelog: v0.11.0...v0.11.1

v0.11.0

12 Nov 11:25
1ed9d49

Choose a tag to compare

NOTE: This release contains breaking changes

If you use Scala Steward, you will migrate automatically.

If you manage your dependency upgrades manually, you must apply a scalafix rule before upgrading. For example with SBT:

sbt scalafixAll github:typelevel/weaver-test/v0_11_0?sha=v0.11.0

What's Changed

Better diffs

This release significantly improves the failure messages of expect.same and expect.eql. It's now easier to tell the difference between the expected and found values, and the diff between the values is more concise due to a pprint-inspired Show instance. Here's an example of a new failure message:

image

To benefit fully, migrate your codebase from expect to equality assertions using the instructions below.

Cleaner migration from expect to equality assertions

0.9.0 dropped support of automatic value capturing in expect, reducing the utility of its error messages. This release improves the scalafix rules for migrating to better expect assertions.

You can migrate from expect to equality assertions using the RewriteExpect rule.

sbt scalafixAll github:typelevel/weaver-test/RewriteExpect?sha=0.11.0

You can further improve your expect error messages by adding clues using the AddClueToExpect rule.

sbt scalafixAll github:typelevel/weaver-test/AddClueToExpect?sha=0.10.1

Consult the weaver documentation for more details.

API changes

This release contains several breaking API changes.

  • AssertionException has been renamed to ExpectationFailed, and its fields modified.
  • The cancel method has been removed in favour of ignore. These two methods had exactly the same behaviour.
  • The verify method is deprecated in favour of expect.
  • The tagged method has been removed in favour of .ignore and .only.
  • The registerTest method has been made final. Instead of overriding registerTest, you can define helper functions that call registerTest. Read the documentation to learn more.
    In addition, the suite hierarchy has been refactored and PureIOSuite has been removed.

If you use Scala Steward, you will migrate automatically.

If you manage your dependency upgrades manually, you must apply the v0_11_0 scalafix rule before upgrading.

Improvements

Bug fixes

API refactors

Updates

  • Update sbt, scripted-plugin to 1.11.5 by @typelevel-steward[bot] in #188
  • Update sbt, scripted-plugin to 1.11.6 by @typelevel-steward[bot] in #203
  • Update fs2-core to 3.12.2 by @typelevel-steward[bot] in #200
  • Update sbt, scripted-plugin to 1.11.7 by @typelevel-steward[bot] in #223
  • Update sbt-snapshot4s, snapshot4s-core to 0.2.2 by @typelevel-steward[bot] in #213
  • Update sbt-typelevel, sbt-typelevel-site to 0.8.1 by @typelevel-steward[bot] in #221
  • Update sbt-scalafix to 0.14.4 by @typelevel-steward[bot] in #229
  • Update sbt-typelevel, sbt-typelevel-site to 0.8.2 by @typelevel-steward[bot] in #230
  • Update sbt-scalafmt to 2.5.6 by @typelevel-steward[bot] in #240
  • Update scalafmt-core to 3.9.10 by @typelevel-steward[bot] in #239
  • Update sbt-scalajs, scalajs-compiler, ... to 1.20.1 by @typelevel-steward[bot] in #235
  • Update scala-library, scala-reflect to 2.13.17 by @typelevel-steward[bot] in #227
  • Update sbt-mdoc to 2.8.0 by @typelevel-steward[bot] in #238
  • Update scala3-library, ... to 3.3.7 by @typelevel-steward[bot] in #236
  • Update scalafmt-core to 3.10.1 by @typelevel-steward[bot] in #246

Behind the scenes

Full Changelog: v0.10.1...v0.11.0

v0.10.1

02 Sep 12:28
4ae5acb

Choose a tag to compare

What's Changed

This release contains a bugfix for compilation errors when expect statements are on the final line of a file. The bug was due to the source location macro implementation, and only occured for Scala 3 when using whitespace syntax.

Improvements

  • Line content should be empty if expectation is on last line. by @zainab-ali in #193

Behind the scenes

Full Changelog: v0.10.0...v0.10.1

v0.10.0

01 Sep 12:49
a595757

Choose a tag to compare

What's Changed

This release improves failure messaging by printing the source location of all failures. New fields needed to be added to the SourceLocation class to achieve this, so this release is binary incompatible.

Improvements

Behind the scenes

  • Update installation instructions in README.md by @zainab-ali in #171
  • Remove references to the removed assert by @kubukoz in #178
  • Mention Gradle support with the multi-backend Scala plugin. by @dubinsky in #187

New Contributors

Full Changelog: v0.9.3...v0.10.0

v0.9.3

25 Jul 14:48
7525319

Choose a tag to compare

What's Changed

The expect macro respects user-provided source locations

You can now specify an implicit source location for helper functions that call expect and expect.all. The source location will be displayed in the failure message. For example:

def myHelper(x: Int, y: Int)(implicit loc: SourceLocation): Expectations = {
  expect(x > y)
}

myHelper(1, 2) // The failure message points to this line in the source code

Improvements

Updates

  • Update cats-effect, cats-effect-testkit to 3.6.2 by @typelevel-steward[bot] in #170
  • Update cats-effect, cats-effect-testkit to 3.6.3 by @typelevel-steward[bot] in #176

Behind the scenes

  • Update sbt-scalafmt to 2.5.5 by @typelevel-steward[bot] in #165
  • Update sbt, scripted-plugin to 1.11.3 by @typelevel-steward[bot] in #168
  • Update sbt-mdoc to 2.7.2 by @typelevel-steward[bot] in #173
  • Add guide on asserting equality. by @zainab-ali in #172

Full Changelog: v0.9.2...v0.9.3

v0.9.2

04 Jul 18:18
6250f99

Choose a tag to compare

What's Changed

expect failure message improved

The expect and expect.all failure messages now contain the source code of the failing assertion.

Improvements

Full Changelog: v0.9.1...v0.9.2

v0.9.1

23 Jun 14:29
64c49f5

Choose a tag to compare

What's Changed

expect failure message improved

The assertion failed message now directs developers towards the clue function.

Improvements

Updates

  • Update scala3-library, ... to 3.3.6 by @typelevel-steward in #148
  • Update scala-library, scala-reflect to 2.13.16 by @zainab-ali in #159
  • Update scala-library, scala-reflect to 2.12.20 by @typelevel-steward in #61
  • Update sbt-scalajs, scalajs-compiler, ... to 1.18.2 by @typelevel-steward in #129
  • Update scalacheck to 1.17.1 by @typelevel-steward in #32
  • Update cats-effect, cats-effect-testkit to 3.5.7 by @typelevel-steward in #116
  • Update cats-effect, cats-effect-testkit to 3.6.1 by @typelevel-steward in #162
  • Update fs2-core to 3.12.0 by @typelevel-steward in #145

Behind the scenes

  • Set tlBaseVersion to 0.9. by @zainab-ali in #152
  • Update sbt-typelevel, sbt-typelevel-site to 0.7.7 by @typelevel-steward in #131
  • Update sbt, scripted-plugin to 1.11.2 by @typelevel-steward in #158
  • Update sbt-typelevel, sbt-typelevel-site to 0.8.0 by @typelevel-steward in #157
  • Update sbt-scalafix to 0.14.3 by @typelevel-steward in #149
  • Update scalafmt-core to 3.9.6 by @typelevel-steward in #147
  • Update sbt-scalafmt to 2.5.4 by @typelevel-steward in #125
  • Update sbt-mdoc to 2.5.4 by @typelevel-steward in #56
  • Update portable-scala-reflect to 1.1.3 by @typelevel-steward in #49
  • Update cats-laws to 2.11.0 by @typelevel-steward in #47
  • Update sbt-mdoc to 2.7.1 by @typelevel-steward in #161
  • Fixup some things in the documentation that are not true anymore by @CJSmith-0141 in #154
  • Add an FAQ about the stewardship change by @zainab-ali in #153
    Full Changelog: v0.9.0...v0.9.1

v0.9.0

27 May 22:00
66dd0a4

Choose a tag to compare

Migrating to weaver 0.9.0

The stewardship of Weaver has moved from disneystreaming to typelevel.

If you use Scala Steward, you will migrate automatically.

If you manage your dependency upgrades manually, you must:

  1. Rename any usages of assert to expect. If you use scalafix, you can apply a scalafix rule. For example, with SBT:
    sbt scalafixAll github:typelevel/weaver-test/RenameAssertToExpect?sha=v0.9.0
    
  2. Rename your weaver dependency:
- libraryDependencies += "com.disneystreaming" %% "weaver-cats" % "x.y.z" % Test
+ libraryDependencies += "org.typelevel" %% "weaver-cats" % "0.9.0" % Test

Rename any usages of CheckConfig.copy to corresponding with* methods:

  override def checkConfig: CheckConfig =
-    super.checkConfig.copy(minimumSuccessful = 1000)
+   super.checkConfig.withMinimumSuccessful(1000)

Note that if you use Scala Native, you may see linking errors due to weaver's shaded munit-diff dependency. You can address these by explicitly adding munit-diff:

libraryDependencies += "org.scalameta" %%% "munit-diff" % munitVersion % Test

What's Changed

assert alias removed

The assert macro has been removed in favour of a better expect. You can rename assert to expect using scalafix, as described above.

expect error messages do not print contents

The expect function no longer prints its contents on failure. It now requires clues to print useful error messages.

You should replace expectations of the form expect(a == b) with expect.same(a, b) using scalafix.

sbt scalafixAll github:typelevel/weaver-test/RewriteExpect?sha=0.11.0

clue support

The expect function now requires clues to print useful error messages. You can read more about clue in the expectations documentation. If you'd prefer to skip the extra troubleshooting step of adding clue to failing expectations, you can add clue to all your existing expectations using scalafix.

sbt scalafixAll github:typelevel/weaver-test/AddClueToExpect?sha=v0.11.0

Better error messages

Weaver's error messages have been greatly improved thanks to munit-diff.

Improvements

Updates

  • Update fs2-core to 3.10.2 by @typelevel-steward in #26
  • Update sbt-scalajs, scalajs-compiler, ... to 1.16.0 by @typelevel-steward in #27
  • Update scala-library, scala-reflect to 2.12.19 by @typelevel-steward in #28
  • Update nscplugin, sbt-scala-native, ... to 0.4.17 by @typelevel-steward in #30
  • Update sbt to 1.9.9 by @typelevel-steward in #31
  • Update scalafmt-core to 3.7.17 by @typelevel-steward in #33
  • Update cats-effect, cats-effect-testkit to 3.5.4 by @typelevel-steward in #34
  • Update sbt-typelevel, sbt-typelevel-site to 0.7.0 by @typelevel-steward in #36
  • Update sbt-scalafix to 0.12.1 by @typelevel-steward in #40
  • Update sbt-shading to 2.1.5 by @typelevel-steward in #46

Behind the scenes

New Contributors

Full Changelog: https://github.com/typelevel/weaver-test/commits/v0.9.0