Skip to content
Snippets Groups Projects
Commit ca8311c3 authored by Denis Zhidkikh's avatar Denis Zhidkikh :horse:
Browse files

Rider: Don't run tests if ComTest didn't generate anything

parent 63e32be9
No related branches found
No related tags found
No related merge requests found
...@@ -25,16 +25,19 @@ internal object ComTestRunner { ...@@ -25,16 +25,19 @@ internal object ComTestRunner {
* *
* @param proj Solution for which to generate the tests. * @param proj Solution for which to generate the tests.
*/ */
fun generateForDotNetSln(proj: Project) { fun generateForDotNetSln(proj: Project): ComTestResult? {
ComTestLoggerWindow.open(proj) ComTestLoggerWindow.open(proj)
val slnFile = proj.riderSolutionFile val slnFile = proj.riderSolutionFile
?: return Notifier.notifyError( ?: run {
Notifier.notifyError(
proj, proj,
"No solution found or solution is virtual (virtual solutions are not supported). Load a solution to generate tests." "No solution found or solution is virtual (virtual solutions are not supported). Load a solution to generate tests."
) )
return null
}
val slnEntry = FileEntry(slnFile.path, Language.CsharpSolution) val slnEntry = FileEntry(slnFile.path, Language.CsharpSolution)
FileProcessor.process(slnEntry, slnFile.parent, false) return FileProcessor.process(slnEntry, slnFile.parent, false)
} }
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.ex.ActionManagerEx ...@@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.ex.ActionManagerEx
import com.jetbrains.rd.platform.util.lifetime import com.jetbrains.rd.platform.util.lifetime
import com.jetbrains.rider.model.solutionAnalysisModel import com.jetbrains.rider.model.solutionAnalysisModel
import com.jetbrains.rider.projectView.solution import com.jetbrains.rider.projectView.solution
import comtest.v2.processors.ComTestResult
import fi.jyu.intellij.comtest.common.util.runWithRefresh import fi.jyu.intellij.comtest.common.util.runWithRefresh
import fi.jyu.intellij.comtest.rider.ComTestRunner import fi.jyu.intellij.comtest.rider.ComTestRunner
import fi.jyu.intellij.comtest.rider.util.hasRiderSolution import fi.jyu.intellij.comtest.rider.util.hasRiderSolution
...@@ -18,10 +19,14 @@ class ComTestGenerateDotNetSolutionAction : AnAction() { ...@@ -18,10 +19,14 @@ class ComTestGenerateDotNetSolutionAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) { override fun actionPerformed(e: AnActionEvent) {
val proj = e.project ?: return val proj = e.project ?: return
runWithRefresh(proj) { val res = runWithRefresh(proj) {
ComTestRunner.generateForDotNetSln(proj) ComTestRunner.generateForDotNetSln(proj)
} }
if (res == null || (res !is ComTestResult.Success && res !is ComTestResult.SkippedAsGood)) {
return
}
// csproj change will trigger assembly analysis // csproj change will trigger assembly analysis
// Wait for it to finish and then trigger unit test discovery // Wait for it to finish and then trigger unit test discovery
val l = proj.lifetime.createNested() val l = proj.lifetime.createNested()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment