Skip to content

Test framework loading error should throw on MatchError #6805

@eed3si9n

Description

@eed3si9n

This was initially reported as scala/scala3#14391

steps

git clone git@github.com:dotty-staging/scodec.git
cd scodec
git co d59c044
sbt -Dsbt.version=1.6.1 test

problem

sbt fails to detect the test framework, but the overall test command succeeds:

[error] Error loading test framework (scala.MatchError: org.scalacheck.ScalaCheckFramework@e944eb6 (of class org.scalacheck.ScalaCheckFramework)). This usually means that you are using a layered class loader that cannot reach the sbt.testing.Framework class. The most likely cause is that your project has a runtime dependency on your test framework, e.g. scalatest. To fix this, you can try to set
[error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] or
[error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[error] Error loading test framework (scala.MatchError: munit.Framework@6f7a32e3 (of class munit.Framework)). This usually means that you are using a layered class loader that cannot reach the sbt.testing.Framework class. The most likely cause is that your project has a runtime dependency on your test framework, e.g. scalatest. To fix this, you can try to set
[error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] or
[error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[error] Error loading test framework (scala.MatchError: munit.Framework@68f39541 (of class munit.Framework)). This usually means that you are using a layered class loader that cannot reach the sbt.testing.Framework class. The most likely cause is that your project has a runtime dependency on your test framework, e.g. scalatest. To fix this, you can try to set
[error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] or
[error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[success] Total time: 35 s, completed Jan 31, 2022 3:57:54 PM

expectation

We should probably fail on MatchError case where we are pretty sure this happens due to classloading issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions