Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package scalajs
    Definition Classes
    org
  • package junit
    Definition Classes
    scalajs
  • package plugin
    Definition Classes
    junit
  • class ScalaJSJUnitPlugin extends Plugin

    The Scala.js jUnit plugin is a way to overcome the lack of annotation information of any test class (usually accessed through reflection).

    The Scala.js jUnit plugin is a way to overcome the lack of annotation information of any test class (usually accessed through reflection). This is all the information required by the Scala.js testing framework to execute the tests.

    As an example we take the following test class:

    class Foo {
      @Before def before(): Unit = {
        // Initialize the instance before the tests
      }
      @Test def bar(): Unit = {
        // assert some stuff
      }
      @Ignore("baz not implemented yet") @Test def baz(): Unit = {
        // assert some other stuff
      }
    }
    
    object Foo {
      @BeforeClass def beforeClass(): Unit = {
        // Initialize some global state for the tests.
      }
    }

    Will generate the following bootstrapper module:

    object Foo$scalajs$junit$bootstrapper extends org.scalajs.junit.JUnitTestBootstrapper {
    
      def metadata(): JUnitClassMetadata = {
        new JUnitClassMetadata(
          classAnnotations = List(),
          moduleAnnotations = List(),
          classMethods = List(
              new JUnitMethodMetadata(name = "before",
                  annotations = List(new Before)),
              new JUnitMethodMetadata(name = "bar",
                  annotations = List(new Test)),
              new JUnitMethodMetadata(name = "baz",
                  annotations = List(new Test, new Ignore("baz not implemented yet")))
          ),
          moduleMethods(
              new JUnitMethodMetadata(name = "beforeClass",
                  annotations = List(new BeforeClass)))
        )
      }
    
      def newInstance(): AnyRef = new Foo()
    
      def invoke(methodName: String): Unit = {
        if (methodName == "0") Foo.beforeClass()
        else throw new NoSuchMethodException(methodId)
      }
    
      def invoke(instance: AnyRef, methodName: String): Unit = {
        if (methodName == "before") instance.asInstanceOf[Foo].before()
        else if (methodName == "bar") instance.asInstanceOf[Foo].bar()
        else if (methodName == "baz") instance.asInstanceOf[Foo].baz()
        else throw new NoSuchMethodException(methodId)
      }
    }

    The test framework will identify Foo$scalajs$junit$bootstrapper as a test module because it extends JUnitTestBootstrapper. It will know which methods to run based on the info returned by Foo$scalajs$junit$bootstrapper.metadata, it will create new test instances using Foo$scalajs$junit$bootstrapper.newInstance() and it will invoke test methods using invoke on the bootstrapper.

    Definition Classes
    plugin
  • ScalaJSJUnitPluginComponent
o

org.scalajs.junit.plugin.ScalaJSJUnitPlugin

ScalaJSJUnitPluginComponent

object ScalaJSJUnitPluginComponent extends PluginComponent with Transform with Compat210Component

Linear Supertypes
Compat210Component, Transform, PluginComponent, SubComponent, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScalaJSJUnitPluginComponent
  2. Compat210Component
  3. Transform
  4. PluginComponent
  5. SubComponent
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. implicit final class DefinitionsCompat extends AnyRef
    Definition Classes
    Compat210Component
  2. implicit final class GenCompat extends AnyRef
    Definition Classes
    Compat210Component
  3. class Phase extends scala.tools.nsc.transform.Transform.StdPhase
    Definition Classes
    Transform
  4. class ScalaJSJUnitPluginTransformer extends scala.tools.nsc.Global.Transformer
  5. abstract class StdPhase extends GlobalPhase
    Definition Classes
    SubComponent

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def TypeTreeMemberType(sym: scala.tools.nsc.Global.Symbol): scala.tools.nsc.Global.TypeTree
    Definition Classes
    Compat210Component
  5. final def afterOwnPhase[T](op: ⇒ T): T
    Definition Classes
    SubComponent
    Annotations
    @inline()
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. final def beforeOwnPhase[T](op: ⇒ T): T
    Definition Classes
    SubComponent
    Annotations
    @inline()
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def description: String
    Definition Classes
    PluginComponent
  10. def enabled: Boolean
    Definition Classes
    SubComponent
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  15. val global: Global
    Definition Classes
    ScalaJSJUnitPluginComponentCompat210Component → SubComponent
  16. def hashCode(): Int
    Definition Classes
    SubComponent → AnyRef → Any
  17. val initial: Boolean
    Definition Classes
    SubComponent
  18. final val internal: Boolean(false)
    Definition Classes
    PluginComponent → SubComponent
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def newDefDef(sym: scala.tools.nsc.Global.Symbol, rhs: scala.tools.nsc.Global.Tree)(mods: scala.tools.nsc.Global.Modifiers = Modifiers(sym.flags), name: scala.tools.nsc.Global.TermName = sym.name.toTermName, tparams: List[scala.tools.nsc.Global.TypeDef] = ..., vparamss: List[List[scala.tools.nsc.Global.ValDef]] = ..., tpt: scala.tools.nsc.Global.Tree = TypeTreeMemberType(sym)): scala.tools.nsc.Global.DefDef
    Definition Classes
    Compat210Component
  22. def newPhase(prev: scala.tools.nsc.Phase): StdPhase
    Definition Classes
    Transform → SubComponent
  23. def newTransformer(unit: scala.tools.nsc.Global.CompilationUnit): scala.tools.nsc.Global.Transformer
    Attributes
    protected
    Definition Classes
    ScalaJSJUnitPluginComponent → Transform
  24. def newValDef(sym: scala.tools.nsc.Global.Symbol, rhs: scala.tools.nsc.Global.Tree)(mods: scala.tools.nsc.Global.Modifiers = Modifiers(sym.flags), name: scala.tools.nsc.Global.TermName = sym.name.toTermName, tpt: scala.tools.nsc.Global.Tree = TypeTreeMemberType(sym)): scala.tools.nsc.Global.ValDef
    Definition Classes
    Compat210Component
  25. final def notify(): Unit
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  27. def ownPhase: scala.tools.nsc.Phase
    Definition Classes
    SubComponent
  28. val phaseName: String
    Definition Classes
    ScalaJSJUnitPluginComponent → SubComponent
  29. def phaseNewFlags: Long
    Definition Classes
    SubComponent
  30. def phaseNextFlags: Long
    Definition Classes
    SubComponent
  31. val requires: List[String]
    Definition Classes
    SubComponent
  32. val runsAfter: List[String]
    Definition Classes
    ScalaJSJUnitPluginComponent → SubComponent
  33. val runsBefore: List[String]
    Definition Classes
    ScalaJSJUnitPluginComponent → SubComponent
  34. val runsRightAfter: Option[String]
    Definition Classes
    PluginComponent → SubComponent
  35. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  36. val terminal: Boolean
    Definition Classes
    SubComponent
  37. def toString(): String
    Definition Classes
    AnyRef → Any
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Compat210Component

Inherited from Transform

Inherited from PluginComponent

Inherited from SubComponent

Inherited from AnyRef

Inherited from Any

Ungrouped