Search in sources :

Example 1 with JstdRunConfiguration

use of com.google.jstestdriver.idea.execution.JstdRunConfiguration in project intellij-plugins by JetBrains.

the class JstdCoverageProgramRunner method start.

@Nullable
private static RunContentDescriptor start(@Nullable JstdServer server, @NotNull ExecutionEnvironment environment) throws ExecutionException {
    FileDocumentManager.getInstance().saveAllDocuments();
    JstdRunConfiguration runConfiguration = (JstdRunConfiguration) environment.getRunProfile();
    CoverageEnabledConfiguration coverageEnabledConfiguration = CoverageEnabledConfiguration.getOrCreate(runConfiguration);
    String coverageFilePath = coverageEnabledConfiguration.getCoverageFilePath();
    JstdRunProfileState jstdState = new JstdRunProfileState(environment, runConfiguration.getRunSettings(), coverageFilePath);
    ExecutionResult executionResult = jstdState.executeWithServer(server);
    RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, environment);
    final RunContentDescriptor descriptor = contentBuilder.showRunContent(environment.getContentToReuse());
    ProcessHandler processHandler = executionResult.getProcessHandler();
    if (processHandler instanceof NopProcessHandler) {
        if (server != null) {
            server.addLifeCycleListener(new JstdServerLifeCycleAdapter() {

                @Override
                public void onBrowserCaptured(@NotNull JstdBrowserInfo info) {
                    ExecutionUtil.restartIfActive(descriptor);
                    server.removeLifeCycleListener(this);
                }
            }, contentBuilder);
        }
    } else {
        CoverageHelper.attachToProcess(runConfiguration, processHandler, environment.getRunnerSettings());
    }
    return descriptor;
}
Also used : JstdRunConfiguration(com.google.jstestdriver.idea.execution.JstdRunConfiguration) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) CoverageEnabledConfiguration(com.intellij.execution.configurations.coverage.CoverageEnabledConfiguration) JstdRunProfileState(com.google.jstestdriver.idea.execution.JstdRunProfileState) NopProcessHandler(com.intellij.execution.process.NopProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionResult(com.intellij.execution.ExecutionResult) NopProcessHandler(com.intellij.execution.process.NopProcessHandler) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder) JstdServerLifeCycleAdapter(com.google.jstestdriver.idea.server.JstdServerLifeCycleAdapter) JstdBrowserInfo(com.google.jstestdriver.idea.server.JstdBrowserInfo) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

JstdRunConfiguration (com.google.jstestdriver.idea.execution.JstdRunConfiguration)1 JstdRunProfileState (com.google.jstestdriver.idea.execution.JstdRunProfileState)1 JstdBrowserInfo (com.google.jstestdriver.idea.server.JstdBrowserInfo)1 JstdServerLifeCycleAdapter (com.google.jstestdriver.idea.server.JstdServerLifeCycleAdapter)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 CoverageEnabledConfiguration (com.intellij.execution.configurations.coverage.CoverageEnabledConfiguration)1 NopProcessHandler (com.intellij.execution.process.NopProcessHandler)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 RunContentBuilder (com.intellij.execution.runners.RunContentBuilder)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 Nullable (org.jetbrains.annotations.Nullable)1