diff --git a/Jenkinsfile b/Jenkinsfile
index 4d11767e67..21e03f6d0a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -31,7 +31,7 @@ node() { // No specific label
}
stage('Unit Test') {
- mvn 'test -Dsonia.scm.test.skip.hg=true'
+ mvn 'test -Dsonia.scm.test.skip.hg=true -Dmaven.test.failure.ignore=true'
}
stage('SonarQube') {
diff --git a/scm-ui/package.json b/scm-ui/package.json
index de30ec8047..d5a642099f 100644
--- a/scm-ui/package.json
+++ b/scm-ui/package.json
@@ -27,7 +27,8 @@
"build-js": "react-scripts build",
"build": "npm-run-all build-css build-js",
"test": "jest",
- "test-coverage": "yarn run test --coverage",
+ "test-coverage": "jest --coverage",
+ "test-ci": "jest --ci --coverage",
"eject": "react-scripts eject",
"flow": "flow"
},
@@ -42,6 +43,7 @@
"fetch-mock": "^6.5.0",
"flow-bin": "^0.75.0",
"flow-typed": "^2.5.1",
+ "jest-junit": "^5.1.0",
"node-sass-chokidar": "^1.3.0",
"npm-run-all": "^4.1.3",
"prettier": "^1.13.7",
@@ -52,5 +54,15 @@
"presets": [
"react-app"
]
+ },
+ "jest": {
+ "coverageDirectory": "target/jest-reports/coverage",
+ "coveragePathIgnorePatterns": [
+ "src/tests/.*"
+ ],
+ "reporters": [ "default", "jest-junit" ]
+ },
+ "jest-junit": {
+ "output": "./target/jest-reports/TEST-all.xml"
}
}
diff --git a/scm-ui/pom.xml b/scm-ui/pom.xml
index b7595d3d76..58c935ad21 100644
--- a/scm-ui/pom.xml
+++ b/scm-ui/pom.xml
@@ -16,6 +16,15 @@
2.0.0-SNAPSHOT
scm-ui
+
+ js
+ src
+ **/*.test.js,src/tests/**
+ **/*.test.js,src/tests/**
+ target/jest-reports
+ target/jest-reports/coverage/lcov.info
+
+
@@ -29,7 +38,7 @@
YARN
- 1.3.2
+ 1.7.0
@@ -51,10 +60,19 @@
+
+ test
+ test
+
+ run
+
+
+
+
+
-
diff --git a/scm-ui/yarn.lock b/scm-ui/yarn.lock
index fe4f475a0f..4063d5135d 100644
--- a/scm-ui/yarn.lock
+++ b/scm-ui/yarn.lock
@@ -4368,6 +4368,10 @@ jest-environment-node@^20.0.3:
jest-mock "^20.0.3"
jest-util "^20.0.3"
+jest-get-type@^22.1.0:
+ version "22.4.3"
+ resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4"
+
jest-haste-map@^20.0.4:
version "20.0.5"
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.5.tgz#abad74efb1a005974a7b6517e11010709cab9112"
@@ -4393,6 +4397,15 @@ jest-jasmine2@^20.0.4:
once "^1.4.0"
p-map "^1.1.1"
+jest-junit@^5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-5.1.0.tgz#e8e497d810a829bf02783125aab74b5df6caa8fe"
+ dependencies:
+ jest-validate "^23.0.1"
+ mkdirp "^0.5.1"
+ strip-ansi "^4.0.0"
+ xml "^1.0.1"
+
jest-matcher-utils@^20.0.3:
version "20.0.3"
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz#b3a6b8e37ca577803b0832a98b164f44b7815612"
@@ -4491,6 +4504,15 @@ jest-validate@^20.0.3:
leven "^2.1.0"
pretty-format "^20.0.3"
+jest-validate@^23.0.1:
+ version "23.4.0"
+ resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.4.0.tgz#d96eede01ef03ac909c009e9c8e455197d48c201"
+ dependencies:
+ chalk "^2.0.1"
+ jest-get-type "^22.1.0"
+ leven "^2.1.0"
+ pretty-format "^23.2.0"
+
jest@20.0.4:
version "20.0.4"
resolved "https://registry.yarnpkg.com/jest/-/jest-20.0.4.tgz#3dd260c2989d6dad678b1e9cc4d91944f6d602ac"
@@ -6218,6 +6240,13 @@ pretty-format@^20.0.3:
ansi-regex "^2.1.1"
ansi-styles "^3.0.0"
+pretty-format@^23.2.0:
+ version "23.2.0"
+ resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.2.0.tgz#3b0aaa63c018a53583373c1cb3a5d96cc5e83017"
+ dependencies:
+ ansi-regex "^3.0.0"
+ ansi-styles "^3.2.0"
+
private@^0.1.6, private@^0.1.7, private@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
@@ -8242,6 +8271,10 @@ xml-name-validator@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635"
+xml@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
+
xtend@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
diff --git a/scm-webapp/src/main/java/sonia/scm/filter/SecurityFilter.java b/scm-webapp/src/main/java/sonia/scm/filter/SecurityFilter.java
index 965e097f64..01967afd00 100644
--- a/scm-webapp/src/main/java/sonia/scm/filter/SecurityFilter.java
+++ b/scm-webapp/src/main/java/sonia/scm/filter/SecurityFilter.java
@@ -70,11 +70,6 @@ public class SecurityFilter extends HttpFilter
@VisibleForTesting
static final String ATTRIBUTE_REMOTE_USER = "principal";
- /** Field description */
- public static final String URL_AUTHENTICATION = "/api/rest/auth";
-
- public static final String URLV2_AUTHENTICATION = "/api/rest/v2/auth";
-
private final ScmConfiguration configuration;
@Inject
diff --git a/scm-webapp/src/test/java/sonia/scm/filter/SecurityFilterTest.java b/scm-webapp/src/test/java/sonia/scm/filter/SecurityFilterTest.java
index 13333cc223..983f8d964a 100644
--- a/scm-webapp/src/test/java/sonia/scm/filter/SecurityFilterTest.java
+++ b/scm-webapp/src/test/java/sonia/scm/filter/SecurityFilterTest.java
@@ -100,14 +100,29 @@ public class SecurityFilterTest {
}
/**
- * Tests filter on authentication endpoint.
- *
+ * Tests filter on authentication endpoint v1.
+ *
* @throws IOException
* @throws ServletException
*/
@Test
- public void testDoOnAuthenticationUrl() throws IOException, ServletException {
- when(request.getRequestURI()).thenReturn("/scm/api/rest/authentication");
+ public void testDoOnAuthenticationUrlV1() throws IOException, ServletException {
+ checkIfAuthenticationUrlIsPassedThrough("/scm/api/rest/auth/access_token");
+ }
+
+ /**
+ * Tests filter on authentication endpoint v2.
+ *
+ * @throws IOException
+ * @throws ServletException
+ */
+ @Test
+ public void testDoOnAuthenticationUrlV2() throws IOException, ServletException {
+ checkIfAuthenticationUrlIsPassedThrough("/scm/api/rest/v2/auth/access_token");
+ }
+
+ private void checkIfAuthenticationUrlIsPassedThrough(String uri) throws IOException, ServletException {
+ when(request.getRequestURI()).thenReturn(uri);
securityFilter.doFilter(request, response, chain);
verify(request, never()).setAttribute(Mockito.anyString(), Mockito.any());
verify(chain).doFilter(request, response);
@@ -235,4 +250,4 @@ public class SecurityFilterTest {
}
-}
\ No newline at end of file
+}
diff --git a/scm.iml b/scm.iml
index a0d516ed9a..4ed0077c7f 100644
--- a/scm.iml
+++ b/scm.iml
@@ -12,5 +12,10 @@
+
+
+
+
+
\ No newline at end of file