aboutsummaryrefslogtreecommitdiffstats
path: root/its
diff options
context:
space:
mode:
authorElena Vilchik2018-06-27 15:22:56 +0200
committerGitHub2018-06-27 15:22:56 +0200
commitcea9681a811f5bced88e443d5fda14ba15396343 (patch)
tree3746b822ead44cf60de9336e6454770710c76960 /its
parentbde3e646ffe1b1ba1b513cac042f5c1e379da4ff (diff)
downloadsonar-css-cea9681a811f5bced88e443d5fda14ba15396343.tar.bz2
Exclude minified files (#93)
Diffstat (limited to 'its')
-rw-r--r--its/plugin/projects/minified-project/src/normal.css3
-rw-r--r--its/plugin/projects/minified-project/src/normal.min.css4
-rw-r--r--its/plugin/projects/minified-project/src/oneline.css1
-rw-r--r--its/plugin/src/test/java/org/sonar/css/its/MinifiedTest.java47
-rw-r--r--its/plugin/src/test/java/org/sonar/css/its/Tests.java4
5 files changed, 57 insertions, 2 deletions
diff --git a/its/plugin/projects/minified-project/src/normal.css b/its/plugin/projects/minified-project/src/normal.css
new file mode 100644
index 0000000..60f1eab
--- /dev/null
+++ b/its/plugin/projects/minified-project/src/normal.css
@@ -0,0 +1,3 @@
+body {
+ color: red;
+}
diff --git a/its/plugin/projects/minified-project/src/normal.min.css b/its/plugin/projects/minified-project/src/normal.min.css
new file mode 100644
index 0000000..d0e3407
--- /dev/null
+++ b/its/plugin/projects/minified-project/src/normal.min.css
@@ -0,0 +1,4 @@
+/* content doesn't matter as file excluded based on filename */
+body {
+ color: red;
+}
diff --git a/its/plugin/projects/minified-project/src/oneline.css b/its/plugin/projects/minified-project/src/oneline.css
new file mode 100644
index 0000000..072f35f
--- /dev/null
+++ b/its/plugin/projects/minified-project/src/oneline.css
@@ -0,0 +1 @@
+/* Styles */ @import url(extra.css);ul li{list-style:square;margin:2em 20% 15px 0}#content{-webkit-font-smoothing:antialiased;background:url(img/gradient.png);background:linear-gradient(to bottom,red,rgba(255,0,0,0))}@media only screen and (min-width:35em){#content{width:50%}}.item+.item,.item~.item{margin-left:-15px}#buttons .lotsofcontent,#buttons>*,input[type=submit]{border-radius:.3rem}a:focus,a:hover{color:green}blockquote::after,blockquote::before{content:"\201d"}
diff --git a/its/plugin/src/test/java/org/sonar/css/its/MinifiedTest.java b/its/plugin/src/test/java/org/sonar/css/its/MinifiedTest.java
new file mode 100644
index 0000000..91580bc
--- /dev/null
+++ b/its/plugin/src/test/java/org/sonar/css/its/MinifiedTest.java
@@ -0,0 +1,47 @@
+/*
+ * SonarCSS
+ * Copyright (C) 2018-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.css.its;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.sonar.css.its.Tests.getProjectMeasureAsDouble;
+
+public class MinifiedTest {
+
+ private static String PROJECT_KEY = "minified-project";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Tests.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void prepare() {
+ orchestrator.executeBuild(Tests.createScanner(PROJECT_KEY));
+ }
+
+ @Test
+ public void test() {
+ assertThat(getProjectMeasureAsDouble("files", PROJECT_KEY)).isEqualTo(1);
+ }
+
+}
diff --git a/its/plugin/src/test/java/org/sonar/css/its/Tests.java b/its/plugin/src/test/java/org/sonar/css/its/Tests.java
index d94a633..df30c9f 100644
--- a/its/plugin/src/test/java/org/sonar/css/its/Tests.java
+++ b/its/plugin/src/test/java/org/sonar/css/its/Tests.java
@@ -29,7 +29,6 @@ import java.util.List;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
-import org.sonar.css.plugin.StylelintReport;
import org.sonarqube.ws.Measures.ComponentWsResponse;
import org.sonarqube.ws.Measures.Measure;
import org.sonarqube.ws.client.HttpConnector;
@@ -41,7 +40,8 @@ import org.sonarqube.ws.client.measures.ComponentRequest;
@Suite.SuiteClasses({
MetricsTest.class,
IssuesTest.class,
- StylelintReportTest.class
+ StylelintReportTest.class,
+ MinifiedTest.class
})
public class Tests {