Skip to content

Commit 8d82784

Browse files
committed
Add FAQ on expecty removal.
1 parent 86d9be0 commit 8d82784

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

docs/faqs/directory.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ laika.navigationOrder = [
33
typelevel_stewardship.md
44
ide_faqs.md,
55
other_effects.md
6+
expecty_removal.md
67
]

docs/faqs/expecty_removal.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Why are my error messages worse ?
2+
=====================================
3+
4+
Weaver `0.9.0` reduced the error reporting power of `expect`.
5+
6+
Prior to `0.9.0`, `expect` would capture the values of its contents on failure. This used the [expecty](https://github.com/eed3si9n/expecty/) macro library to introspect code. While the macro behaved well in most cases, it came with a high maintenance burden. Users reported many bugs in the Scala 3 implementation that were non-trivial to fix.
7+
8+
As the stewardship of weaver moved to Typelevel, it was decided to cut the cord with expecty in order to eliminate this maintenance burden, and to bring in `clue` (inspired from munit) as a much simpler alternative.
9+
10+
Expecty's error messages were well loved, and this decision may be disappointing for users. However, it will allow maintainers to focus on improving other aspects of weaver.
11+
12+
## How can I improve my error messages?
13+
14+
You can rewrite your `expect` assertions into `expect.same` calls, and add `clue` to any remaining assertions.
15+
16+
We recommend you do this automatically by [applying a scalafix rule](https://scalacenter.github.io/scalafix/docs/rules/external-rules.html).
17+
18+
Run the `RewriteExpect` rule to rewrite `expect` and `expect.all` into assertions with better failure messages.
19+
20+
```sh
21+
sbt scalafixAll github:typelevel/weaver-test/RewriteExpect?sha=@VERSION@
22+
```
23+
24+
Run the `AddClueToExpect` rule to add `clue` calls to the remaining `expect` assertions.
25+
26+
```sh
27+
sbt scalafixAll github:typelevel/weaver-test/AddClueToExpect?sha=@VERSION@
28+
```
29+
30+
Your failure messages will now include the values captured in `clue`.

0 commit comments

Comments
 (0)