aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-css-plugin/src/test
diff options
context:
space:
mode:
authorElena Vilchik2018-06-28 10:15:14 +0200
committerAmaury Levé2018-06-28 10:15:14 +0200
commit3006ae9acfe75609cd843c7017735f5584ec236b (patch)
tree7246d9208502ec349fd70bdb2fb07e574ce4c60f /sonar-css-plugin/src/test
parentace698da0dd37aee4070fbabce052ec30fe89395 (diff)
downloadsonar-css-3006ae9acfe75609cd843c7017735f5584ec236b.tar.bz2
Improve logic of node executable detection (#95)
Diffstat (limited to 'sonar-css-plugin/src/test')
-rw-r--r--sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintCommandProviderTest.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintCommandProviderTest.java b/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintCommandProviderTest.java
index 3ae3250..0a44e18 100644
--- a/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintCommandProviderTest.java
+++ b/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintCommandProviderTest.java
@@ -57,20 +57,30 @@ public class StylelintCommandProviderTest {
}
@Test
- public void test_node_executable() throws Exception {
+ public void test_node_executable_wo_settings() throws Exception {
StylelintCommandProvider stylelintCommandProvider = new StylelintCommandProvider();
-
MapSettings settings = new MapSettings();
assertThat(stylelintCommandProvider.nodeExecutable(settings.asConfig())).isEqualTo("node");
assertThat(logTester.logs(LoggerLevel.WARN)).isEmpty();
+ }
+ @Test
+ public void test_node_executable_custom() throws Exception {
+ StylelintCommandProvider stylelintCommandProvider = new StylelintCommandProvider();
+ MapSettings settings = new MapSettings();
File customNode = temporaryFolder.newFile("custom-node.exe");
settings.setProperty(CssPlugin.NODE_EXECUTABLE, customNode.getAbsolutePath());
assertThat(stylelintCommandProvider.nodeExecutable(settings.asConfig())).isEqualTo(customNode.getAbsolutePath());
assertThat(logTester.logs(LoggerLevel.WARN)).isEmpty();
+ }
+ @Test
+ public void test_node_executable_custom_invalid() throws Exception {
+ StylelintCommandProvider stylelintCommandProvider = new StylelintCommandProvider();
+
+ MapSettings settings = new MapSettings();
settings.setProperty(CssPlugin.NODE_EXECUTABLE, "mynode");
assertThat(stylelintCommandProvider.nodeExecutable(settings.asConfig())).isEqualTo("node");
- assertThat(logTester.logs(LoggerLevel.WARN)).contains("Provided node executable file does not exist: mynode");
+ assertThat(logTester.logs(LoggerLevel.WARN)).contains("Provided node executable file does not exist: mynode. Fallback to using 'node' from path.");
}
}