tests: share munit config via SharedFunSuiteBase#5315
Merged
Conversation
scalafmt-tests defined its own `package object scalafmt` (only an implicit munit `DiffOptions`). A package may have just one package object across a classpath, so once scalafmt-core also defines `package object scalafmt`, the two `org/scalafmt/package$.class` files collide: it compiles, but at test runtime the test module's copy shadows core's and core's calls throw `NoSuchMethodError`. Centralize the implicit `DiffOptions` in a new `SharedFunSuiteBase extends munit.FunSuite` that all suites extend, remove the test `package object scalafmt`, and migrate `FormatAssertions` off the deprecated `Diffs.unifiedDiff` (which required the implicit) to `new Diff(...).unifiedDiff`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scalafmt-tests defined its own
package object scalafmt(only an implicit munitDiffOptions). A package may have just one package object across a classpath, so once scalafmt-core also definespackage object scalafmt, the twoorg/scalafmt/package$.classfiles collide: it compiles, but at test runtime the test module's copy shadows core's and core's calls throwNoSuchMethodError.Centralize the implicit
DiffOptionsin a newSharedFunSuiteBase extends munit.FunSuitethat all suites extend, remove the testpackage object scalafmt, and migrateFormatAssertionsoff the deprecatedDiffs.unifiedDiff(which required the implicit) tonew Diff(...).unifiedDiff.