@@ -3,7 +3,7 @@ package scala.build.internal
33import coursier .jvm .Execve
44import org .scalajs .jsenv .jsdomnodejs .JSDOMNodeJSEnv
55import org .scalajs .jsenv .nodejs .NodeJSEnv
6- import org .scalajs .jsenv .{Input , RunConfig }
6+ import org .scalajs .jsenv .{Input , JSEnv , RunConfig }
77import org .scalajs .testing .adapter .TestAdapter as ScalaJsTestAdapter
88import sbt .testing .{Framework , Status }
99
@@ -378,14 +378,27 @@ object Runner {
378378
379379 def frameworkNames (
380380 classPath : Seq [Path ],
381- parentInspector : AsmTestRunner .ParentInspector
381+ parentInspector : AsmTestRunner .ParentInspector ,
382+ logger : Logger
382383 ): Either [NoTestFrameworkFoundError , Seq [String ]] = {
383- val foundFrameworkServices = AsmTestRunner .findFrameworkServices(classPath)
384+ logger.debug(" Looking for test framework services on the classpath..." )
385+ val foundFrameworkServices =
386+ AsmTestRunner .findFrameworkServices(classPath)
387+ .map(_.replace('/' , '.' ).replace('\\ ' , '.' ))
388+ logger.debug(s " Found ${foundFrameworkServices.length} test framework services. " )
389+ if foundFrameworkServices.nonEmpty then
390+ logger.debug(s " - ${foundFrameworkServices.mkString(" \n - " )}" )
391+ logger.debug(" Looking for more test frameworks on the classpath..." )
384392 val foundFrameworks =
385393 AsmTestRunner .findFrameworks(classPath, TestRunner .commonTestFrameworks, parentInspector)
386- val frameworks : Seq [String ] =
387- (foundFrameworkServices ++ foundFrameworks)
388394 .map(_.replace('/' , '.' ).replace('\\ ' , '.' ))
395+ logger.debug(s " Found ${foundFrameworks.length} additional test frameworks " )
396+ if foundFrameworks.nonEmpty then
397+ logger.debug(s " - ${foundFrameworks.mkString(" \n - " )}" )
398+ val frameworks : Seq [String ] = foundFrameworkServices ++ foundFrameworks
399+ logger.log(s " Found ${frameworks.length} test frameworks in total " )
400+ if frameworks.nonEmpty then
401+ logger.debug(s " - ${frameworks.mkString(" \n - " )}" )
389402 if frameworks.nonEmpty then Right (frameworks) else Left (new NoTestFrameworkFoundError )
390403 }
391404
@@ -401,23 +414,30 @@ object Runner {
401414 ): Either [TestError , Int ] = either {
402415 import org .scalajs .jsenv .Input
403416 import org .scalajs .jsenv .nodejs .NodeJSEnv
417+ logger.debug(" Preparing to run tests with Scala.js..." )
418+ logger.debug(s " Scala.js tests class path: $classPath" )
404419 val nodePath = findInPath(" node" ).fold(" node" )(_.toString)
405- val jsEnv =
406- if jsDom then
420+ logger.debug(s " Node found at $nodePath" )
421+ val jsEnv : JSEnv =
422+ if jsDom then {
423+ logger.log(" Loading JS environment with JS DOM..." )
407424 new JSDOMNodeJSEnv (
408425 JSDOMNodeJSEnv .Config ()
409426 .withExecutable(nodePath)
410427 .withArgs(Nil )
411428 .withEnv(Map .empty)
412429 )
413- else
430+ }
431+ else {
432+ logger.log(" Loading JS environment with Node..." )
414433 new NodeJSEnv (
415434 NodeJSEnv .Config ()
416435 .withExecutable(nodePath)
417436 .withArgs(Nil )
418437 .withEnv(Map .empty)
419438 .withSourceMap(NodeJSEnv .SourceMap .Disable )
420439 )
440+ }
421441 val adapterConfig = ScalaJsTestAdapter .Config ().withLogger(logger.scalaJsLogger)
422442 val inputs =
423443 Seq (if esModule then Input .ESModule (entrypoint.toPath) else Input .Script (entrypoint.toPath))
@@ -428,7 +448,7 @@ object Runner {
428448 val parentInspector = new AsmTestRunner .ParentInspector (classPath)
429449 val foundFrameworkNames : List [String ] = testFrameworkOpt match {
430450 case some @ Some (_) => some.toList
431- case None => value(frameworkNames(classPath, parentInspector)).toList
451+ case None => value(frameworkNames(classPath, parentInspector, logger )).toList
432452 }
433453
434454 val res =
@@ -470,12 +490,13 @@ object Runner {
470490 args : Seq [String ],
471491 logger : Logger
472492 ): Either [TestError , Int ] = either {
493+ logger.debug(" Preparing to run tests with Scala Native..." )
473494 logger.debug(s " Native tests class path: $classPath" )
474495
475496 val parentInspector = new AsmTestRunner .ParentInspector (classPath)
476497 val foundFrameworkNames : List [String ] = frameworkNameOpt match {
477498 case Some (fw) => List (fw)
478- case None => value(frameworkNames(classPath, parentInspector)).toList
499+ case None => value(frameworkNames(classPath, parentInspector, logger )).toList
479500 }
480501
481502 val config = ScalaNativeTestAdapter .Config ()
0 commit comments