-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from makepanic/run-configuration-ember-t
Add support for ember test run configuration
- Loading branch information
Showing
20 changed files
with
911 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
src/main/kotlin/com/emberjs/configuration/EmberCommandLineState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/kotlin/com/emberjs/configuration/test/EmberTestCommandLineState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.emberjs.configuration.test | ||
|
||
import com.emberjs.configuration.EmberCommandLineState | ||
import com.emberjs.configuration.EmberConfiguration | ||
import com.intellij.execution.DefaultExecutionResult | ||
import com.intellij.execution.ExecutionResult | ||
import com.intellij.execution.Executor | ||
import com.intellij.execution.configurations.RunConfiguration | ||
import com.intellij.execution.process.ProcessHandler | ||
import com.intellij.execution.runners.ExecutionEnvironment | ||
import com.intellij.execution.runners.ProgramRunner | ||
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil | ||
import com.intellij.execution.testframework.autotest.ToggleAutoTestAction | ||
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.createAndAttachConsole | ||
|
||
class EmberTestCommandLineState(environment: ExecutionEnvironment) : EmberCommandLineState(environment) { | ||
private val TEST_FRAMEWORK_NAME = "ember-qunit" | ||
|
||
override fun execute(executor: Executor, runner: ProgramRunner<*>): ExecutionResult { | ||
val configuration = (environment.runProfile as EmberConfiguration) | ||
|
||
// enforce teamcity reporter because converter requires it | ||
(configuration.options as EmberTestOptions).reporter.value = "teamcity" | ||
|
||
val processHandler: ProcessHandler = startProcess() | ||
|
||
val properties = EmberTestConsoleProperties(configuration as RunConfiguration, TEST_FRAMEWORK_NAME, executor) | ||
val console = createAndAttachConsole(TEST_FRAMEWORK_NAME, processHandler, properties) | ||
|
||
SMTestRunnerConnectionUtil.createAndAttachConsole(TEST_FRAMEWORK_NAME, processHandler, properties) | ||
|
||
val executionResult = DefaultExecutionResult(console, processHandler, *createActions(console, processHandler)) | ||
executionResult.setRestartActions(ToggleAutoTestAction()) | ||
return executionResult | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/kotlin/com/emberjs/configuration/test/EmberTestConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.emberjs.configuration.test | ||
|
||
import com.emberjs.configuration.EmberConfiguration | ||
import com.emberjs.configuration.test.ui.EmberTestSettingsEditor | ||
import com.intellij.execution.ExecutionException | ||
import com.intellij.execution.Executor | ||
import com.intellij.execution.configurations.* | ||
import com.intellij.execution.runners.ExecutionEnvironment | ||
import com.intellij.openapi.options.SettingsEditor | ||
import com.intellij.openapi.project.Project | ||
import org.jdom.Element | ||
import org.jetbrains.annotations.NotNull | ||
import org.jetbrains.annotations.Nullable | ||
|
||
class EmberTestConfiguration(project: Project, factory: ConfigurationFactory, name: String) : RunConfigurationBase(project, factory, name), EmberConfiguration { | ||
override val options = EmberTestOptions() | ||
override val command: String = "test" | ||
|
||
@NotNull | ||
override fun getConfigurationEditor(): SettingsEditor<out RunConfiguration> { | ||
return EmberTestSettingsEditor() | ||
} | ||
|
||
@Throws(RuntimeConfigurationException::class) | ||
override fun checkConfiguration() { | ||
|
||
} | ||
|
||
@Nullable | ||
@Throws(ExecutionException::class) | ||
override fun getState(@NotNull executor: Executor, @NotNull executionEnvironment: ExecutionEnvironment): RunProfileState? { | ||
return EmberTestCommandLineState(executionEnvironment) | ||
} | ||
|
||
override fun writeExternal(element: Element) { | ||
super.writeExternal(element) | ||
element.let { | ||
options.fields().forEach { optionsField -> optionsField.writeTo(element)} | ||
} | ||
} | ||
|
||
override fun readExternal(element: Element) { | ||
super.readExternal(element) | ||
element.let { | ||
options.fields().forEach { optionsField -> optionsField.readFrom(element) } | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/com/emberjs/configuration/test/EmberTestConfigurationFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.emberjs.configuration.test | ||
|
||
import com.intellij.execution.configurations.ConfigurationFactory | ||
import com.intellij.execution.configurations.ConfigurationType | ||
import com.intellij.execution.configurations.RunConfiguration | ||
import com.intellij.openapi.project.Project | ||
|
||
class EmberTestConfigurationFactory(type: ConfigurationType) : ConfigurationFactory(type) { | ||
|
||
override fun createTemplateConfiguration(project: Project): RunConfiguration { | ||
return EmberTestConfiguration(project, this, "Ember test") | ||
} | ||
|
||
override fun getName(): String { | ||
return FACTORY_NAME; | ||
} | ||
|
||
companion object { | ||
private val FACTORY_NAME = "Ember test configuration factory" | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/com/emberjs/configuration/test/EmberTestConfigurationType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.emberjs.configuration.test | ||
|
||
import com.emberjs.icons.EmberIcons | ||
import com.intellij.execution.configurations.ConfigurationFactory | ||
import com.intellij.execution.configurations.ConfigurationTypeBase | ||
|
||
class EmberTestConfigurationType : ConfigurationTypeBase( | ||
"EMBER_TEST_CONFIGURATION", | ||
"Ember Test", | ||
"Ember Test Configuration", | ||
EmberIcons.ICON_16 | ||
) { | ||
override fun getConfigurationFactories(): Array<ConfigurationFactory> { | ||
return arrayOf(EmberTestConfigurationFactory(this)) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/com/emberjs/configuration/test/EmberTestConsoleProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.emberjs.configuration.test | ||
|
||
import com.intellij.execution.Executor | ||
import com.intellij.execution.configurations.RunConfiguration | ||
import com.intellij.execution.testframework.TestConsoleProperties | ||
import com.intellij.execution.testframework.sm.SMCustomMessagesParsing | ||
import com.intellij.execution.testframework.sm.runner.OutputToGeneralTestEventsConverter | ||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties | ||
|
||
class EmberTestConsoleProperties( | ||
configuration: RunConfiguration, | ||
TEST_FRAMEWORK_NAME: String, | ||
executor: Executor) : SMTRunnerConsoleProperties( | ||
configuration, | ||
TEST_FRAMEWORK_NAME, | ||
executor | ||
), SMCustomMessagesParsing { | ||
override fun createTestEventsConverter(testFrameworkName: String, consoleProperties: TestConsoleProperties): OutputToGeneralTestEventsConverter { | ||
return EmberTestOutputToGeneralTestEventsConverter(testFrameworkName, consoleProperties); | ||
} | ||
} |
Oops, something went wrong.