diff options
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala b/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala index 1fc4e32e..93721e8f 100644 --- a/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala +++ b/scalaplugin/src/main/scala/mill/scalaplugin/TestRunner.scala @@ -39,7 +39,16 @@ object TestRunner { def apply(frameworkName: String, entireClasspath: Seq[Path], testClassfilePath: Seq[Path]): Unit = { - val cl = new URLClassLoader(entireClasspath.map(_.toIO.toURI.toURL).toArray, getClass.getClassLoader) + val outerClassLoader = getClass.getClassLoader + val cl = new URLClassLoader(entireClasspath.map(_.toIO.toURI.toURL).toArray){ + override def findClass(name: String) = { + if (name.startsWith("sbt.testing.")){ + outerClassLoader.loadClass(name) + }else{ + super.findClass(name) + } + } + } val framework = cl.loadClass(frameworkName) .newInstance() |