Skip to content

tests: share munit config via SharedFunSuiteBase#5315

Merged
kitbellew merged 1 commit into
scalameta:mainfrom
kitbellew:5315
Jul 4, 2026
Merged

tests: share munit config via SharedFunSuiteBase#5315
kitbellew merged 1 commit into
scalameta:mainfrom
kitbellew:5315

Conversation

@kitbellew

@kitbellew kitbellew commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

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.

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>
@kitbellew kitbellew merged commit 963d2df into scalameta:main Jul 4, 2026
63 of 64 checks passed
@kitbellew kitbellew deleted the 5315 branch July 4, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant