Skip to content

Commit

Permalink
Remove duplication in unit test (.spec.ts/.test.ts)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyennk92 committed Jan 15, 2020
1 parent 6be9951 commit adeb000
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/com/nguyennk/action/TsAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.nguyennk.action
import com.intellij.execution.ProgramRunnerUtil
import com.intellij.execution.RunManager
import com.intellij.execution.RunnerAndConfigurationSettings
import com.intellij.execution.actions.RunContextAction
import com.intellij.execution.executors.DefaultDebugExecutor
import com.intellij.execution.executors.DefaultRunExecutor
import com.intellij.icons.AllIcons
import com.intellij.javascript.jest.JestConfigurationType
import com.intellij.lang.javascript.TypeScriptFileType
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
Expand All @@ -16,7 +16,6 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.jetbrains.nodejs.run.NodeJsRunConfiguration
import com.jetbrains.nodejs.run.NodeJsRunConfigurationType
import java.io.File
import javax.swing.Icon

open class TsAction(icon: Icon = AllIcons.Actions.Execute) : AnAction(icon) {
Expand Down Expand Up @@ -80,9 +79,10 @@ open class TsAction(icon: Icon = AllIcons.Actions.Execute) : AnAction(icon) {

private fun getExistedConfiguration(file: VirtualFile, project: Project): RunnerAndConfigurationSettings? {
val runManager = RunManager.getInstance(project)
val type = NodeJsRunConfigurationType.getInstance()
val settingList = runManager.getConfigurationSettingsList(type)
return settingList.find { x ->
val runSettings = runManager.getConfigurationSettingsList(NodeJsRunConfigurationType.getInstance())
val testSettings = runManager.getConfigurationSettingsList(JestConfigurationType.getInstance())
val allSettings = runSettings.union(testSettings)
return allSettings.find { x ->
val config = x.configuration as NodeJsRunConfiguration
var workingDirectory = config.workingDirectory.orEmpty()
if (!workingDirectory.endsWith("/")) {
Expand Down

0 comments on commit adeb000

Please sign in to comment.