Search in sources :

Example 1 with GoTestRunningState

use of com.goide.runconfig.testing.GoTestRunningState in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoCoverageProgramRunner method doExecute.

@Nullable
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
    assert state instanceof GoTestRunningState;
    GoTestRunningState runningState = (GoTestRunningState) state;
    GoTestRunConfiguration runConfiguration = ObjectUtils.tryCast(environment.getRunProfile(), GoTestRunConfiguration.class);
    if (runConfiguration == null) {
        return null;
    }
    FileDocumentManager.getInstance().saveAllDocuments();
    CoverageEnabledConfiguration coverageEnabledConfiguration = CoverageEnabledConfiguration.getOrCreate(runConfiguration);
    runningState.setCoverageFilePath(coverageEnabledConfiguration.getCoverageFilePath());
    ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
    if (executionResult == null) {
        return null;
    }
    CoverageHelper.attachToProcess(runConfiguration, executionResult.getProcessHandler(), environment.getRunnerSettings());
    return new RunContentBuilder(executionResult, environment).showRunContent(environment.getContentToReuse());
}
Also used : CoverageEnabledConfiguration(com.intellij.execution.configurations.coverage.CoverageEnabledConfiguration) GoTestRunConfiguration(com.goide.runconfig.testing.GoTestRunConfiguration) ExecutionResult(com.intellij.execution.ExecutionResult) GoTestRunningState(com.goide.runconfig.testing.GoTestRunningState) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

GoTestRunConfiguration (com.goide.runconfig.testing.GoTestRunConfiguration)1 GoTestRunningState (com.goide.runconfig.testing.GoTestRunningState)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 CoverageEnabledConfiguration (com.intellij.execution.configurations.coverage.CoverageEnabledConfiguration)1 RunContentBuilder (com.intellij.execution.runners.RunContentBuilder)1 Nullable (org.jetbrains.annotations.Nullable)1