diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc817d4..1fcf9ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -268,6 +268,31 @@ jobs: modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 docs-output_2.12 docs-output_2.13 docs-output_3 weaver-docs_2.12 weaver-docs_2.13 weaver-docs_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 configs-ignore: test scala-tool scala-doc-tool test-internal + validate-steward: + name: Validate Steward Config + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@11] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (fast) + uses: actions/checkout@v4 + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + + - uses: coursier/setup-action@v1 + with: + apps: scala-steward + + - run: scala-steward validate-repo-config .scala-steward.conf + site: name: Generate Site strategy: diff --git a/.scala-steward.conf b/.scala-steward.conf new file mode 100644 index 0000000..36a9108 --- /dev/null +++ b/.scala-steward.conf @@ -0,0 +1 @@ +updates.ignore = [ { groupId = "org.scalameta", artifactId="scala-diff" } ] diff --git a/build.sbt b/build.sbt index 606a35c..e0e8a3a 100644 --- a/build.sbt +++ b/build.sbt @@ -52,6 +52,7 @@ val Version = new { val testInterface = "1.0" val scalacCompatAnnotation = "0.1.4" val http4s = "0.23.26" + val munitDiff = "1.0.0-RC1" } lazy val root = tlCrossRootProject.aggregate(core, @@ -71,9 +72,15 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) "com.eed3si9n.expecty" %%% "expecty" % Version.expecty, // https://github.com/portable-scala/portable-scala-reflect/issues/23 "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13, - "org.typelevel" %% "scalac-compat-annotation" % Version.scalacCompatAnnotation - ) - ) + "org.typelevel" %% "scalac-compat-annotation" % Version.scalacCompatAnnotation, + "org.scalameta" %%% "munit-diff" % Version.munitDiff + ), + // Shades the scala-diff dependency. + shadedDependencies += "org.scalameta" %%% "munit-diff" % "", + shadingRules += ShadingRule.moveUnder("munit.diff", + "weaver.internal.shaded"), + validNamespaces ++= Set("weaver", "org") + ).enablePlugins(ShadingPlugin) lazy val coreJVM = core.jvm .settings( diff --git a/modules/core/shared/src/main/scala/weaver/Comparison.scala b/modules/core/shared/src/main/scala/weaver/Comparison.scala index d6f7055..16cef6d 100644 --- a/modules/core/shared/src/main/scala/weaver/Comparison.scala +++ b/modules/core/shared/src/main/scala/weaver/Comparison.scala @@ -2,8 +2,8 @@ package weaver import cats.Eq import cats.Show -import com.eed3si9n.expecty._ import scala.annotation.implicitNotFound +import munit.diff.Diffs /** * A type class used to compare two instances of the same type and construct an @@ -44,14 +44,8 @@ object Comparison { if (eqv.eqv(found, expected)) { Result.Success } else { - val expectedLines = showA.show(expected).linesIterator.toSeq - val foundLines = showA.show(found).linesIterator.toSeq - val report = DiffUtil - .mkColoredLineDiff(expectedLines, foundLines) - .linesIterator - .toSeq - .map(str => Console.RESET.toString + str) - .mkString("\n") + val report = + Diffs.createDiffOnlyReport(showA.show(found), showA.show(expected)) Result.Failure(report) } } diff --git a/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala b/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala index 0e7cda5..ffa4aff 100644 --- a/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala +++ b/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala @@ -268,12 +268,11 @@ object DogFoodTests extends IOSuite { |- (eql Comparison) 0ms | Values not equal: (src/main/DogFoodTests.scala:5) | - | Foo { | Foo { - | s: foo | s: foo - | i: [1] | i: [2] - | } | } - """.stripMargin.trim - + | => Diff (- obtained, + expected) + | s: foo + | - i: 2 + | + i: 1 + | }""".stripMargin.trim expect.same(actual, expected) } } @@ -292,12 +291,11 @@ object DogFoodTests extends IOSuite { |- (same Comparison) 0ms | Values not equal: (src/main/DogFoodTests.scala:5) | - | Foo { | Foo { - | s: foo | s: foo - | i: [1] | i: [2] - | } | } - """.stripMargin.trim - + | => Diff (- obtained, + expected) + | s: foo + | - i: 2 + | + i: 1 + | }""".stripMargin.trim expect.same(actual, expected) } } diff --git a/project/plugins.sbt b/project/plugins.sbt index 95ce543..95f5459 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ // format: off addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") @@ -12,3 +12,5 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.7") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2") + +addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.4")