@@ -3,7 +3,7 @@ package scala.build.internal
3
3
import coursier .jvm .Execve
4
4
import org .scalajs .jsenv .jsdomnodejs .JSDOMNodeJSEnv
5
5
import org .scalajs .jsenv .nodejs .NodeJSEnv
6
- import org .scalajs .jsenv .{Input , RunConfig }
6
+ import org .scalajs .jsenv .{Input , JSEnv , RunConfig }
7
7
import org .scalajs .testing .adapter .TestAdapter as ScalaJsTestAdapter
8
8
import sbt .testing .{Framework , Status }
9
9
@@ -378,14 +378,27 @@ object Runner {
378
378
379
379
def frameworkNames (
380
380
classPath : Seq [Path ],
381
- parentInspector : AsmTestRunner .ParentInspector
381
+ parentInspector : AsmTestRunner .ParentInspector ,
382
+ logger : Logger
382
383
): 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..." )
384
392
val foundFrameworks =
385
393
AsmTestRunner .findFrameworks(classPath, TestRunner .commonTestFrameworks, parentInspector)
386
- val frameworks : Seq [String ] =
387
- (foundFrameworkServices ++ foundFrameworks)
388
394
.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 - " )}" )
389
402
if frameworks.nonEmpty then Right (frameworks) else Left (new NoTestFrameworkFoundError )
390
403
}
391
404
@@ -401,23 +414,30 @@ object Runner {
401
414
): Either [TestError , Int ] = either {
402
415
import org .scalajs .jsenv .Input
403
416
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" )
404
419
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..." )
407
424
new JSDOMNodeJSEnv (
408
425
JSDOMNodeJSEnv .Config ()
409
426
.withExecutable(nodePath)
410
427
.withArgs(Nil )
411
428
.withEnv(Map .empty)
412
429
)
413
- else
430
+ }
431
+ else {
432
+ logger.log(" Loading JS environment with Node..." )
414
433
new NodeJSEnv (
415
434
NodeJSEnv .Config ()
416
435
.withExecutable(nodePath)
417
436
.withArgs(Nil )
418
437
.withEnv(Map .empty)
419
438
.withSourceMap(NodeJSEnv .SourceMap .Disable )
420
439
)
440
+ }
421
441
val adapterConfig = ScalaJsTestAdapter .Config ().withLogger(logger.scalaJsLogger)
422
442
val inputs =
423
443
Seq (if esModule then Input .ESModule (entrypoint.toPath) else Input .Script (entrypoint.toPath))
@@ -428,7 +448,7 @@ object Runner {
428
448
val parentInspector = new AsmTestRunner .ParentInspector (classPath)
429
449
val foundFrameworkNames : List [String ] = testFrameworkOpt match {
430
450
case some @ Some (_) => some.toList
431
- case None => value(frameworkNames(classPath, parentInspector)).toList
451
+ case None => value(frameworkNames(classPath, parentInspector, logger )).toList
432
452
}
433
453
434
454
val res =
@@ -470,12 +490,13 @@ object Runner {
470
490
args : Seq [String ],
471
491
logger : Logger
472
492
): Either [TestError , Int ] = either {
493
+ logger.debug(" Preparing to run tests with Scala Native..." )
473
494
logger.debug(s " Native tests class path: $classPath" )
474
495
475
496
val parentInspector = new AsmTestRunner .ParentInspector (classPath)
476
497
val foundFrameworkNames : List [String ] = frameworkNameOpt match {
477
498
case Some (fw) => List (fw)
478
- case None => value(frameworkNames(classPath, parentInspector)).toList
499
+ case None => value(frameworkNames(classPath, parentInspector, logger )).toList
479
500
}
480
501
481
502
val config = ScalaNativeTestAdapter .Config ()
0 commit comments