use of com.intellij.javascript.karma.execution.KarmaConsoleView in project intellij-plugins by JetBrains.
the class KarmaDebugProgramRunner method execute.
@NotNull
@Override
protected Promise<RunContentDescriptor> execute(@NotNull ExecutionEnvironment environment, @NotNull RunProfileState state) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
if (executionResult == null) {
return Promise.resolve(null);
}
KarmaConsoleView consoleView = KarmaConsoleView.get(executionResult, state);
if (consoleView == null) {
return Promise.resolve(KarmaUtil.createDefaultDescriptor(executionResult, environment));
}
KarmaServer karmaServer = consoleView.getKarmaExecutionSession().getKarmaServer();
if (karmaServer.areBrowsersReady()) {
KarmaDebugBrowserSelector browserSelector = new KarmaDebugBrowserSelector(karmaServer.getCapturedBrowsers(), environment, consoleView);
DebuggableWebBrowser debuggableWebBrowser = browserSelector.selectDebugEngine();
if (debuggableWebBrowser == null) {
return Promises.resolvedPromise(KarmaUtil.createDefaultDescriptor(executionResult, environment));
}
return KarmaKt.prepareKarmaDebugger(environment.getProject(), debuggableWebBrowser, () -> createDescriptor(environment, executionResult, consoleView, karmaServer, debuggableWebBrowser));
} else {
RunContentDescriptor descriptor = KarmaUtil.createDefaultDescriptor(executionResult, environment);
karmaServer.onBrowsersReady(() -> ExecutionUtil.restartIfActive(descriptor));
return Promises.resolvedPromise(descriptor);
}
}
use of com.intellij.javascript.karma.execution.KarmaConsoleView in project intellij-plugins by JetBrains.
the class KarmaCoverageProgramRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull final ExecutionEnvironment env) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult = state.execute(env.getExecutor(), this);
if (executionResult == null) {
return null;
}
RunContentDescriptor descriptor = KarmaUtil.createDefaultDescriptor(executionResult, env);
KarmaConsoleView consoleView = KarmaConsoleView.get(executionResult, state);
if (consoleView == null) {
return descriptor;
}
KarmaServer server = consoleView.getKarmaExecutionSession().getKarmaServer();
if (server.areBrowsersReady()) {
listenForCoverageFile(env, server);
} else {
server.onBrowsersReady(() -> ExecutionUtil.restartIfActive(descriptor));
}
return descriptor;
}
Aggregations