question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lots of Builds in the community-build are silently skipping tests and even test-compiles

See original GitHub issue

It looks like lots of Builds not running or even compiling their tests. When they get to testing this happens:

2022-01-30T08:16:22.4896099Z [error] Error loading test framework (java.lang.NoClassDefFoundError: sbt/testing/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
2022-01-30T08:16:22.4899342Z [error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
2022-01-30T08:16:22.4900029Z [error] or
2022-01-30T08:16:22.4900718Z [error] Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
2022-01-30T08:16:22.5477827Z [success] Total time: 23 s, completed Jan 30, 2022 9:16:22 AM

As similar issues happens for some builds trying to use ZTestFramework:

2022-01-30T08:21:26.8954542Z [error] Error loading test framework (scala.MatchError: zio.test.sbt.ZTestFramework@31fd0360 (of class zio.test.sbt.ZTestFramework)). 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

When this error occurs in a project, none of the tests will be run or even compiled. It is effectively a total disabling of testing code for the given project.

I first saw these in the my quill PR builds: Screenshot from 2022-01-31 11-48-26

Some quick grepping (attached) shows me this is happening for the following projects:

in community-build-a

  • scalatest
  • scala-stm
  • scalatestplus-testng
  • izumi-reflect
  • Lucre

in community-build-c

  • protoquill (I got this one…)
  • akka
  • jackson-module-scala
  • libretto
  • xml-interpolator
  • scalatestplus-scalacheck
  • scala-parallel-collections
  • sconfig
  • onnx-scala

I solved this problem by adding something slightly different to my settings:

Compile / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat

When I added this, the error went away.

This could all be totally wrong and my grepping could be incorrect too but I’ve tried this with the quill build. I tried running the community build with and actual compile error in my scalatests and without the classLoaderLayeringStrategy parameter. The build passes as though nothing is wrong.

I think that project owners should maybe have a look at their builds and see if this is happening for them.

grepping_results.txt

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
eed3si9ncommented, Jan 31, 2022

I have a PR up so it won’t silently succeed the build - https://github.com/sbt/sbt/pull/6806

1reaction
griggtcommented, Jan 31, 2022

our community build apparently still injects the obsolete sbt-dotty plugin

Any objection to discontinuing this practice and manually fixing up in the dotty-staging forks any projects that have not updated upstream?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lots of community-build projects not running or even ...
Lots of Scala Community-Build projects are not running or even compiling their tests. They are silently failing with: [error] Error loading ...
Read more >
Maven is automatically skipping tests - Stack Overflow
The debug output shows this: [DEBUG] (s) skip = true. which not only skips running the tests, it will also skip compiling them....
Read more >
So you think you can skip tests? The "dark side" of Maven
When using Maven Release Plugin constructs like mvn release:perform -DskipTests don't work at all. To understand why, let's look at the docs ...
Read more >
Beware silently skipped tests in Mocha - Adam Coster
Any Mocha.js tests defined within an async describe function will be silently skipped! (Don't use async functions in your describe() ...
Read more >
New mysql-test-run option to minimize skipped tests in ...
This is a better behavior than silently skipping tests. ... of tests which should continue to skip even if MTR is run with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found