Releases: typelevel/weaver-test
v0.12.0
NOTE: This release contains breaking changes
If your code fails to compile, follow the migration notes below.
What's Changed
Scala Native 0.5 support
This release supports Scala Native 0.5.10.
failFast can raise multiple failed expectations
The error raised by failFast now contains all failed expectations, and not just the first failure.
This requires a new ExpectationsFailed type.
Migrating to ExpectationsFailed
If your code patten matches on the ExpectationFailed type, you will need to match on ExpectationsFailed instead:
expect.same(1, 2)
.failFast[IO] // Now raises ExpectationsFailed
.recover {
- case Left(_: ExpectationFailed) => ...
+ case Left(_: ExpectationsFailed) => ...
}If your code explicitly raises ExpectationFailed errors, you will need to raise ExpectationsFailed:
IO.raiseError(
+ new ExpectationsFailed(NonEmptyList.of(
new ExpectationFailed("my error", NonEmptyList.of(loc))
+ ))
)Removal of EffectSuite.Provider and Suite[F]
The EffectSuite.Provider type was previously introduced to support different effect types.
You can now support your own effect type by extending SharedResourceSuite. See the weaver guide for examples of how to use it.
To simplify the suite hierarchy, the Suite[F] type has been removed in favour of EffectSuite[F]. You should be able to replace any usages of Suite[F] with EffectSuite[F].
If you have trouble migrating your code, don't hesitate to raise an issue.
API changes
- Modify
failFastto raise multiple expectation failures. by @zainab-ali in #250 - Remove
EffectSuite.Providerin favour ofSharedResourceSuiteby @zainab-ali in #224
Updates
- Update scala-library, scala-reflect to 2.12.21 by @typelevel-steward[bot] in #263
- Update sbt-scalajs, scalajs-compiler, ... to 1.20.2 by @typelevel-steward[bot] in #270
- Update Scala Native, Cats Effect, fs2 & related deps by @majk-p in #289
Behind the scenes
- Document how to define custom test functions by @zainab-ali in #269
- Improve guide on filtering tests. by @zainab-ali in #272
- Update sbt-snapshot4s, snapshot4s-core to 0.2.5 by @typelevel-steward[bot] in #268
- Update sbt-mdoc to 2.8.2 by @typelevel-steward[bot] in #266
- Update sbt-typelevel, sbt-typelevel-site to 0.8.4 by @typelevel-steward[bot] in #265
- Update sbt-scalafix to 0.14.5 by @typelevel-steward[bot] in #264
- Update sbt, scripted-plugin to 1.12.5 by @typelevel-steward[bot] in #287
- Update sbt-typelevel, sbt-typelevel-site to 0.8.5 by @typelevel-steward[bot] in #284
- Update sbt-snapshot4s, snapshot4s-core to 0.2.7 by @typelevel-steward[bot] in #281
- Update sbt-snapshot4s, snapshot4s-core to 0.2.8 by @typelevel-steward[bot] in #288
- Update scalafmt-core to 3.10.7 by @typelevel-steward[bot] in #282
- Update sbt-scalafix to 0.14.6 by @typelevel-steward[bot] in #286
Full Changelog: v0.11.3...v0.12.0
v0.11.3
What's Changed
This release contains a new matchOrFailFast utility. You can see an example of it in the expectations guide.
API changes
- Create matchOrFailFast utility by @LaurenceWarne in #226
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
- @LaurenceWarne made their first contribution in #226
Full Changelog: v0.11.2...v0.11.3
v0.11.2
What's Changed
This release contains a bugfix for test-specific scalacheck config being ignored.
Bug fixes
- Checkers apply functions should preserve config. by @zainab-ali in #257
Full Changelog: v0.11.1...v0.11.2
v0.11.1
What's Changed
This release contains a fixes a bug in the ignore logic for property tests.
Bug fixes
- Ignore property tests with
ignoreby @zainab-ali in #255
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
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:
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.
AssertionExceptionhas been renamed toExpectationFailed, and its fields modified.- The
cancelmethod has been removed in favour ofignore. These two methods had exactly the same behaviour. - The
verifymethod is deprecated in favour ofexpect. - The
taggedmethod has been removed in favour of.ignoreand.only. - The
registerTestmethod has been made final. Instead of overridingregisterTest, you can define helper functions that callregisterTest. Read the documentation to learn more.
In addition, the suite hierarchy has been refactored andPureIOSuitehas 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
- Improve diff rendering with multi-line show instance by @zainab-ali in #245
- Improve equality assertion failure message by @zainab-ali in #241
Bug fixes
- Render expected value on failure when string diff is the same. by @zainab-ali in #190
- Add a new line between failure messages and logs. by @zainab-ali in #196
- Print seed when property test fails with
failFastby @zainab-ali in #209 - Fix bug in
--onlyargument detection. by @zainab-ali in #220 - Propagate source location in checkers failure message. by @zainab-ali in #225
API refactors
- Deprecate
verifyin favour ofexpectby @zainab-ali in #248 - Remove
taggedfunction in favour of sealed trait. by @zainab-ali in #249 - Refactor Result and Exception classes. by @zainab-ali in #192
- Remove
Blockercompatibility for CE2 and 3. by @zainab-ali in #202 - Remove unsable
PureIOSuiteby @zainab-ali in #219 - Modify suite hierarchy to allow combining
CheckersandDisciplinetraits. by @zainab-ali in #218
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
- Publish snapshots on feature branches. by @zainab-ali in #194
- Use snapshot4s plugin in DogFoodTests. by @zainab-ali in #195
- Delete unused
codecsmodule by @zainab-ali in #198 - Do not shade munit-diff for Scala native. by @zainab-ali in #211
- Reformat with scalafmt. by @zainab-ali in #216
- Refactor tag analysis logic in
WeaverRunnerby @zainab-ali in #217 - Relax private constraint for exception classes. by @zainab-ali in #222
- Reformat MultiLineShow with new scalafmt version. by @zainab-ali in #247
- Move DogFoodTests to snapshot tests by @zainab-ali in #197
- Add scalafix rules for 0.11.x by @zainab-ali in #228
- Improve
RenameExpectSameToExpectrule to apply toexpect.allby @zainab-ali in #242 - Improve verify deprecation message. by @zainab-ali in #251
- Improvements to scalafix rules for
v0.11.0by @zainab-ali in #252
Full Changelog: v0.10.1...v0.11.0
v0.10.1
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
- Document clue usage by @zainab-ali in #184
Full Changelog: v0.10.0...v0.10.1
v0.10.0
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
- Work around
possible missing interpolatorlint by @zainab-ali in #179 - Make
SourceLocationa class for binary-compatible evolution. by @zainab-ali in #181 - Less discarding of test failure throwables by @dubinsky in #183
- Print source code for all failures by @zainab-ali in #174
Behind the scenes
- Update installation instructions in README.md by @zainab-ali in #171
- Remove references to the removed
assertby @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
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 codeImprovements
- Propagate source locations in expect macro by @zainab-ali in #175
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
What's Changed
expect failure message improved
The expect and expect.all failure messages now contain the source code of the failing assertion.
Improvements
- Scalafix rules for adding clues and using
expect.sameby @zainab-ali in #164 - Improve failure message of
expect.allby @zainab-ali in #166 - Add source code to error message of expect. by @zainab-ali in #167
Full Changelog: v0.9.1...v0.9.2
v0.9.1
What's Changed
expect failure message improved
The assertion failed message now directs developers towards the clue function.
Improvements
- Direct users towards clue function. by @zainab-ali in #160
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