Search in sources :

Example 1 with NodeJsInterpreter

use of com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter in project intellij-plugins by JetBrains.

the class KarmaRunProfileState method getServerOrStart.

@Nullable
public KarmaServer getServerOrStart(@NotNull final Executor executor) throws ExecutionException {
    NodeJsInterpreter interpreter = myRunSettings.getInterpreterRef().resolve(myProject);
    NodeJsLocalInterpreter localInterpreter = NodeJsLocalInterpreter.castAndValidate(interpreter);
    KarmaServerSettings serverSettings = new KarmaServerSettings.Builder().setNodeInterpreter(localInterpreter).setKarmaPackage(myKarmaPackage).setRunSettings(myRunSettings).setWithCoverage(myExecutionType == KarmaExecutionType.COVERAGE).setDebug(myExecutionType == KarmaExecutionType.DEBUG).build();
    KarmaServerRegistry registry = KarmaServerRegistry.getInstance(myProject);
    KarmaServer server = registry.getServer(serverSettings);
    if (server != null && server.getRestarter().isRestartRequired()) {
        server.shutdownAsync();
        server = null;
    }
    if (server == null) {
        registry.startServer(serverSettings, new CatchingConsumer<KarmaServer, Exception>() {

            @Override
            public void consume(KarmaServer server) {
                RunnerAndConfigurationSettings configuration = myEnvironment.getRunnerAndConfigurationSettings();
                if (configuration != null) {
                    ProgramRunnerUtil.executeConfiguration(myProject, configuration, executor);
                }
            }

            @Override
            public void consume(final Exception e) {
                LOG.error(e);
                showServerStartupError(e);
            }
        });
    }
    return server;
}
Also used : NodeJsInterpreter(com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter) KarmaServer(com.intellij.javascript.karma.server.KarmaServer) NodeJsLocalInterpreter(com.intellij.javascript.nodejs.interpreter.local.NodeJsLocalInterpreter) KarmaServerRegistry(com.intellij.javascript.karma.server.KarmaServerRegistry) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with NodeJsInterpreter

use of com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter in project intellij-plugins by JetBrains.

the class KarmaRunConfiguration method check.

private void check(@NotNull NodePackage karmaPackage) throws RuntimeConfigurationException {
    NodeJsInterpreter interpreter = myRunSettings.getInterpreterRef().resolve(getProject());
    NodeJsLocalInterpreter.checkForRunConfiguration(interpreter);
    karmaPackage.validateForRunConfiguration(KarmaUtil.NODE_PACKAGE_NAME);
    validatePath("configuration file", myRunSettings.getConfigPath());
    if (myRunSettings.getScopeKind() == KarmaScopeKind.TEST_FILE) {
        validatePath("test file", myRunSettings.getTestFileSystemDependentPath());
    }
}
Also used : NodeJsInterpreter(com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter)

Aggregations

NodeJsInterpreter (com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter)2 KarmaServer (com.intellij.javascript.karma.server.KarmaServer)1 KarmaServerRegistry (com.intellij.javascript.karma.server.KarmaServerRegistry)1 NodeJsLocalInterpreter (com.intellij.javascript.nodejs.interpreter.local.NodeJsLocalInterpreter)1 Nullable (org.jetbrains.annotations.Nullable)1