use of com.google.jstestdriver.PluginLoader in project intellij-plugins by JetBrains.
the class JstdServerMain method main.
public static void main(String[] args) {
shutdownIfOrphan();
try {
// pre-parse parsing... These are the flags
// that must be dealt with before we parse the flags.
CmdLineFlags cmdLineFlags = new CmdLineFlagsFactory().create(args);
List<Plugin> cmdLinePlugins = cmdLineFlags.getPlugins();
// configure logging before we start seriously processing.
LogManager.getLogManager().readConfiguration(cmdLineFlags.getRunnerMode().getLogConfig());
final PluginLoader pluginLoader = new PluginLoader();
// load all the command line plugins.
final List<Module> pluginModules = pluginLoader.load(cmdLinePlugins);
logger.log(Level.INFO, "loaded plugins {0}", pluginModules);
JsTestDriverBuilder builder = new JsTestDriverBuilder();
BasePaths basePath = cmdLineFlags.getBasePath();
builder.addBasePaths(basePath);
builder.setDefaultConfiguration(new DefaultConfiguration(basePath));
builder.setConfigurationSource(cmdLineFlags.getConfigurationSource());
builder.addPluginModules(pluginModules);
builder.withPluginInitializer(TestResultPrintingModule.TestResultPrintingInitializer.class);
builder.setRunnerMode(cmdLineFlags.getRunnerMode());
builder.setFlags(cmdLineFlags.getUnusedFlagsAsArgs());
builder.addServerListener(new JstdIntellijServerListener());
JsTestDriver jstd = builder.build();
jstd.runConfiguration();
logger.info("Finished action run.");
} catch (InvalidFlagException e) {
e.printErrorMessages(System.out);
CmdLineFlags.printUsage(System.out);
System.exit(1);
} catch (UnreadableFilesException e) {
System.out.println("Configuration Error: \n" + e.getMessage());
e.printStackTrace();
System.exit(1);
} catch (ConfigurationException e) {
System.out.println("Configuration Error: \n" + e.getMessage());
e.printStackTrace();
System.exit(1);
} catch (RetryException e) {
System.out.println("Tests failed due to unexpected environment issue: " + e.getCause().getMessage());
System.exit(1);
} catch (FailureException e) {
System.out.println("Tests failed: " + e.getMessage());
System.exit(1);
} catch (BrowserPanicException e) {
System.out.println("Test run failed due to unresponsive browser: " + e);
System.exit(1);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Unexpected Runner Condition: " + e.getMessage() + "\n Use --runnerMode DEBUG for more information.");
System.exit(1);
}
}
Aggregations