softwaremill / diffx

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

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

Open matankdr opened 9 months ago

matankdr commented 9 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