use of com.intellij.javascript.testFramework.JsTestElementPath in project intellij-plugins by JetBrains.
the class KarmaRunConfigurationProducer method setupAsSuiteOrTest.
@Nullable
private static Pair<KarmaRunSettings, PsiElement> setupAsSuiteOrTest(@NotNull JSFile file, @NotNull VirtualFile virtualFile, @NotNull PsiElement element, @NotNull KarmaRunSettings templateSettings) {
TextRange textRange = element.getTextRange();
if (textRange == null || !file.isTestFile()) {
return null;
}
JasmineFileStructure jasmineStructure = JasmineFileStructureBuilder.getInstance().fetchCachedTestFileStructure(file);
JsTestElementPath path = jasmineStructure.findTestElementPath(textRange);
if (path != null) {
templateSettings = guessConfigFileIfNeeded(templateSettings, virtualFile, element.getProject());
KarmaRunSettings.Builder builder = templateSettings.toBuilder();
String testName = path.getTestName();
if (testName == null) {
builder.setScopeKind(KarmaScopeKind.SUITE);
builder.setTestNames(path.getSuiteNames());
} else {
builder.setScopeKind(KarmaScopeKind.TEST);
builder.setTestNames(path.getAllNames());
}
return Pair.create(builder.build(), path.getTestElement());
}
return null;
}
Aggregations