Class ExportTestFunctions

java.lang.Object
com.google.javascript.jscomp.ExportTestFunctions
All Implemented Interfaces:
CompilerPass

public class ExportTestFunctions extends Object implements CompilerPass
Generates goog.exportSymbol for test functions, so they can be recognized by the test runner, even if the code is compiled.
  • Method Details

    • process

      public void process(Node externs, Node root)
      Description copied from interface: CompilerPass
      Process the JS with root node root. Can modify the contents of each Node tree
      Specified by:
      process in interface CompilerPass
      Parameters:
      externs - Top of external JS tree
      root - Top of JS tree
    • isTestFunction

      public static boolean isTestFunction(String functionName)
      Whether a function is recognized as a test function. We follow the JsUnit convention for naming (functions should start with "test"), and we also check if it has no parameters declared.
      Parameters:
      functionName - The name of the function
      Returns:
      true if the function is recognized as a test function.