softwaremill / diffx

Pretty diffs for scala case classes
Apache License 2.0
342 stars 30 forks source link

Question: Define common `Diff`s in a shared trait #458

Open matankdr opened 11 months ago

matankdr commented 11 months ago

I would like to define common Diff instances to be used in multiple test suites. However, when defined something like:

trait MyCommonDiffs {
  implicit val diffA: Diff[A] = ???
  implicit val diffB: Diff[B] = ???
}

and mixed in test suite:

class MyTest extends SpecificationWithJUnit with MyCommonDiffs {
...
}

The implicit Diff instances were not recognized by matchTo matcher. Is there any best practices of how to summon implicit Diffs defined in a common trait/lib?

cc @galtoren