Library Integrations

MUnit

Add this to your SBT build

"com.github.jatcwang" %% "difflicious-munit" % "0.4.0" % Test

and then in your test suites you can call assertNoDiff on any Differ.

import munit.FunSuite
import difflicious.munit.MUnitDiff._
import difflicious.Differ

class MyTest extends FunSuite {
  test("a == b") { 
    Differ[Int].assertNoDiff(1, 2)
  }
}

Scalatest

Add this to your SBT build

"com.github.jatcwang" %% "difflicious-scalatest" % "0.4.0" % Test

Tests should be run with the -oW option to disable Scalatest from coloring test failures all red as it interferes with difflicious color display.

testOnly -- -oW

Here’s an example of what a test using difflicious looks like:

import org.scalatest.funsuite.AnyFunSuite
import difflicious.scalatest.ScalatestDiff._
import difflicious.Differ

class MyTest extends AnyFunSuite {
  test("a == b") { 
    Differ[Int].assertNoDiff(1, 2)
  }
}

Cats

Differ instances for cats data structures like NonEmptyList and Chain can be found in

"com.github.jatcwang" %% "difflicious-scalatest" % "0.4.0" % Test
import difflicious.Differ
import difflicious.cats.implicits._
import cats.data.{NonEmptyMap, NonEmptyList}

val differ: Differ[List[NonEmptyMap[String, NonEmptyList[Int]]]] = Differ[List[NonEmptyMap[String, NonEmptyList[Int]]]]
// differ: Differ[List[NonEmptyMap[String, NonEmptyList[Int]]]] = difflicious.differ.SeqDiffer@63771188