use of org.sonarsource.sonarlint.core.plugin.commons.SkipReason in project sonarlint-core by SonarSource.
the class StandaloneNodeJsTests method unsatisfied_node_version.
@Test
void unsatisfied_node_version() throws Exception {
List<String> logs = new ArrayList<>();
var configBuilder = StandaloneGlobalConfiguration.builder().addPlugin(PluginLocator.getJavaScriptPluginPath()).addEnabledLanguages(Language.JS, Language.TS).setSonarLintUserHome(sonarlintUserHome).setNodeJs(Paths.get("node"), Version.create("1.0")).setModulesProvider(() -> singletonList(new ClientModuleInfo("key", mock(ClientModuleFileSystem.class)))).setLogOutput((msg, level) -> logs.add(msg));
sonarlint = new StandaloneSonarLintEngineImpl(configBuilder.build());
assertThat(logs).contains("Plugin 'JavaScript/TypeScript Code Quality and Security' requires Node.js 8.0.0 while current is 1.0. Skip loading it.");
var skipReason = sonarlint.getPluginDetails().stream().filter(p -> p.key().equals("javascript")).findFirst().get().skipReason();
assertThat(skipReason).isNotEmpty();
assertThat(skipReason.get()).isInstanceOf(SkipReason.UnsatisfiedRuntimeRequirement.class);
var unsatisfiedNode = (SkipReason.UnsatisfiedRuntimeRequirement) skipReason.get();
assertThat(unsatisfiedNode.getRuntime()).isEqualTo(SkipReason.UnsatisfiedRuntimeRequirement.RuntimeRequirement.NODEJS);
assertThat(unsatisfiedNode.getCurrentVersion()).isEqualTo("1.0");
assertThat(unsatisfiedNode.getMinVersion()).isEqualTo("8.0.0");
assertThat(sonarlint.getRuleDetails(JAVASCRIPT_S1481)).isEmpty();
final var issues = analyze();
assertThat(issues).isEmpty();
}
Aggregations