private static class TestElementRunSettingsProvider implements JstdRunSettingsProvider {
@Override
public JstdRunSettings provideSettings(@NotNull PsiElement psiElement) {
JSFile jsFile = ObjectUtils.tryCast(psiElement.getContainingFile(), JSFile.class);
if (jsFile == null) {
return null;
}
VirtualFile virtualFile = jsFile.getVirtualFile();
if (virtualFile == null || virtualFile.getFileType() != JavaScriptSupportLoader.JAVASCRIPT) {
return null;
}
TestFileStructurePack pack = TestFileStructureManager.fetchTestFileStructurePackByJsFile(jsFile);
if (pack == null) {
return null;
}
JstdRunElement jstdRunElement = pack.getJstdRunElement(psiElement);
if (jstdRunElement != null) {
Project project = jsFile.getProject();
JstdRunSettings.Builder builder = new JstdRunSettings.Builder();
builder.setJSFilePath(getPath(virtualFile));
builder.setTestCaseName(jstdRunElement.getTestCaseName());
List<VirtualFile> jstdConfigs = JstdTestFilePathIndex.findConfigFilesInProject(virtualFile, project);
if (jstdConfigs.size() == 1) {