Open
Description
I found a strange issue with weaver around initialization... or at least that is what I think.
It is a bit involved but hopefully, I can provide enough info for someone to take a look.
// First, we need a base Suite with a bunch of helpers:
trait FooBaseSuite extends IOSuite:
override final val maxParallelism: Int = 1
override final type Res = FooRes
override final val sharedResource: Resource[IO, Res] = ???
// Define helper method to reduce boilerplate:
protected def fooTest(name: String)(check: Foo => Expectations): Unit =
test(name) { foo =>
IO(check(foo))
}
// Then we need an object that extends such base Suite:
object FooSpec extends FooBaseSuite:
// And use the helper method:
fooTest(name = "Testing foo") { foo =>
expect(...)
}
The tests will fail because Foo
is already closed (or so I think).
There are a couple of ways to fix the issue:
- Don't have a
trait
+object
but just a singleobject
- Remove the
fooTest
helper and replicate the boilerplate in eachtest
- Make
FooSpec
aclass
which accepts an (unused)GlobalRead
Things that didn't work:
- Using
abstract class
rather thantrait
- Moving
fooTest
from thetrait
(FooBaseSuite
) to theobject
(FooSpec
)
More info:
- Scala
3.3.1
- weaver:
0.8.3
- cats-effect:
3.5.1
- sbt:
1.9.6
- Java: GraalVM CE
17.0.8
- OS: Mac
14.0
Metadata
Assignees
Labels
No labels