Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b7af872

Browse files
rudolf101zishkaz
andauthored
Fix non-indexing test files for JavaScript (#1907)
Co-authored-by: Sergey Loktev <loktevsergay.2003@gmail.com>
1 parent a720808 commit b7af872

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎utbot-intellij-js/src/main/kotlin/org/utbot/intellij/plugin/language/js/JsDialogProcessor.kt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,16 @@ object JsDialogProcessor {
186186
val generatedCode = testGenerator.run()
187187
invokeLater {
188188
runWriteAction {
189-
val testPsiFile = testDir.findFile(testFileName) ?: PsiFileFactory.getInstance(project)
190-
.createFileFromText(testFileName, JsLanguageAssistant.jsLanguage, generatedCode)
189+
val testPsiFile = testDir.findFile(testFileName) ?: run {
190+
val temp = PsiFileFactory.getInstance(project)
191+
.createFileFromText(testFileName, JsLanguageAssistant.jsLanguage, generatedCode)
192+
testDir.add(temp)
193+
testDir.findFile(testFileName)!!
194+
}
191195
val testFileEditor = CodeInsightUtil.positionCursor(project, testPsiFile, testPsiFile)
192196
unblockDocument(project, testFileEditor.document)
193197
testFileEditor.document.setText(generatedCode)
194198
unblockDocument(project, testFileEditor.document)
195-
testDir.findFile(testFileName) ?: testDir.add(testPsiFile)
196199
}
197200
}
198201
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /