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
  • object ScalaJSJUnitPluginComponent extends PluginComponent with Transform with Compat210Component
    Definition Classes
    ScalaJSJUnitPlugin
  • DefinitionsCompat
  • GenCompat
  • Phase
  • ScalaJSJUnitPluginTransformer
  • StdPhase

class ScalaJSJUnitPluginTransformer extends scala.tools.nsc.Global.Transformer

Linear Supertypes
scala.tools.nsc.Global.Transformer, scala.tools.nsc.Global.Transformer, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScalaJSJUnitPluginTransformer
  2. Transformer
  3. Transformer
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ScalaJSJUnitPluginTransformer()

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def atOwner[A](owner: scala.tools.nsc.Global.Symbol)(trans: ⇒ A): A
    Definition Classes
    Transformer
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def currentClass: scala.tools.nsc.Global.Symbol
    Attributes
    protected
    Definition Classes
    Transformer
  8. def currentMethod: scala.tools.nsc.Global.Symbol
    Attributes
    protected
    Definition Classes
    Transformer
  9. var currentOwner: scala.tools.nsc.Global.Symbol
    Attributes
    protected[scala]
    Definition Classes
    Transformer
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def jUnitAnnotatedMethods(sym: scala.tools.nsc.Global.Symbol): List[scala.tools.nsc.Global.MethodSymbol]
  17. def mkBootstrapperClass(clazz: scala.tools.nsc.Global.ClassDef, modDefOption: Option[scala.tools.nsc.Global.ClassDef]): scala.tools.nsc.Global.ClassDef
  18. def mkGetJUnitMetadataDef(clSym: scala.tools.nsc.Global.Symbol, modSymOption: Option[scala.tools.nsc.Global.Symbol]): scala.tools.nsc.Global.DefDef
  19. def mkInvokeJUnitMethodOnInstanceDef(methods: List[scala.tools.nsc.Global.MethodSymbol], classSym: scala.tools.nsc.Global.Symbol, refClassSym: scala.tools.nsc.Global.Symbol): scala.tools.nsc.Global.DefDef

    This method generates a method that invokes a test method in the class given its name.

    This method generates a method that invokes a test method in the class given its name. These methods have no parameters.

    Example:

    class Foo {
      @Test def bar(): Unit
      @Test def baz(): Unit
    }
    object Foo$scalajs$junit$bootstrapper {
      // This is the method generated by mkInvokeJUnitMethodOnInstanceDef
      def invoke(instance: AnyRef, methodName: String): Unit = {
        if (methodName == "bar") instance.asInstanceOf[Foo].bar()
        else if (methodName == "baz") instance.asInstanceOf[Foo].baz()
        else throw new NoSuchMethodException(methodName + " not found")
      }
    }
  20. def mkInvokeJUnitMethodOnModuleDef(methods: List[scala.tools.nsc.Global.MethodSymbol], bootSym: scala.tools.nsc.Global.Symbol, modClassSym: Option[scala.tools.nsc.Global.Symbol]): scala.tools.nsc.Global.DefDef

    This method generates a method that invokes a test method in the module given its name.

    This method generates a method that invokes a test method in the module given its name. These methods have no parameters.

    Example:

    object Foo {
      @BeforeClass def bar(): Unit
      @AfterClass def baz(): Unit
    }
    object Foo$scalajs$junit$bootstrapper {
      // This is the method generated by mkInvokeJUnitMethodOnModuleDef
      def invoke(methodName: String): Unit = {
        if (methodName == "bar") Foo.bar()
        else if (methodName == "baz") Foo.baz()
        else throw new NoSuchMethodException(methodName + " not found")
      }
    }
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. def transform(tree: scala.tools.nsc.Global.Tree): scala.tools.nsc.Global.Tree
    Definition Classes
    ScalaJSJUnitPluginTransformer → Transformer
  27. def transformCaseDefs(trees: List[scala.tools.nsc.Global.CaseDef]): List[scala.tools.nsc.Global.CaseDef]
    Definition Classes
    Transformer
  28. def transformIdents(trees: List[scala.tools.nsc.Global.Ident]): List[scala.tools.nsc.Global.Ident]
    Definition Classes
    Transformer
  29. def transformMemberDefs(trees: List[scala.tools.nsc.Global.MemberDef]): List[scala.tools.nsc.Global.MemberDef]
    Definition Classes
    Transformer
  30. def transformModifiers(mods: scala.tools.nsc.Global.Modifiers): scala.tools.nsc.Global.Modifiers
    Definition Classes
    Transformer
  31. def transformStats(stats: List[scala.tools.nsc.Global.Tree], exprOwner: scala.tools.nsc.Global.Symbol): List[scala.tools.nsc.Global.Tree]
    Definition Classes
    Transformer
  32. def transformTemplate(tree: scala.tools.nsc.Global.Template): scala.tools.nsc.Global.Template
    Definition Classes
    Transformer
  33. def transformTrees(trees: List[scala.tools.nsc.Global.Tree]): List[scala.tools.nsc.Global.Tree]
    Definition Classes
    Transformer
  34. def transformTypeDefs(trees: List[scala.tools.nsc.Global.TypeDef]): List[scala.tools.nsc.Global.TypeDef]
    Definition Classes
    Transformer
  35. def transformUnit(unit: scala.tools.nsc.Global.CompilationUnit): Unit
    Definition Classes
    Transformer
  36. def transformValDef(tree: scala.tools.nsc.Global.ValDef): scala.tools.nsc.Global.ValDef
    Definition Classes
    Transformer
  37. def transformValDefs(trees: List[scala.tools.nsc.Global.ValDef]): List[scala.tools.nsc.Global.ValDef]
    Definition Classes
    Transformer
  38. def transformValDefss(treess: List[List[scala.tools.nsc.Global.ValDef]]): List[List[scala.tools.nsc.Global.ValDef]]
    Definition Classes
    Transformer
  39. val treeCopy: scala.tools.nsc.Global.TreeCopier
    Definition Classes
    Transformer
  40. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from scala.tools.nsc.Global.Transformer

Inherited from scala.tools.nsc.Global.Transformer

Inherited from AnyRef

Inherited from Any

Ungrouped