From c092f290ecb3b2d0674f614ef465a8df0f7b91a9 Mon Sep 17 00:00:00 2001
From: Alejandro Celaya <alejandrocelaya@gmail.com>
Date: Wed, 22 Aug 2018 10:44:24 +0200
Subject: [PATCH] Added integration with scrutinizer

---
 .scrutinizer.yml |  2 ++
 .travis.yml      |  5 ++++-
 README.md        |  6 +++++-
 package.json     |  8 ++++++++
 yarn.lock        | 10 ++++++++++
 5 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 .scrutinizer.yml

diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 00000000..87fda201
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,2 @@
+tools:
+  external_code_coverage: true
diff --git a/.travis.yml b/.travis.yml
index e5689640..5fb72bc5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,10 @@ install:
 
 script:
   # - yarn inspect
-  - yarn test
+  - yarn test --coverage
   - yarn build # Make sure the app can be built without errors
 
+after_script:
+  - yarn ocular coverage/clover.xml
+
 sudo: false
diff --git a/README.md b/README.md
index 50ec89ef..88727204 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,10 @@
 # shlink-web-client
 
-[![Build Status](https://travis-ci.org/shlinkio/shlink-web-client.svg?branch=master)](https://travis-ci.org/shlinkio/shlink-web-client)
+[![Build Status](https://img.shields.io/travis/shlinkio/shlink-web-client.svg?style=flat-square)](https://travis-ci.org/shlinkio/shlink-web-client)
+[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/shlinkio/shlink-web-client.svg?style=flat-square)](https://scrutinizer-ci.com/gshlinkio/shlink-web-client/?branch=master)
+[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/shlinkio/shlink-web-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink-web-client/?branch=master)
+[![GitHub release](https://img.shields.io/github/release/shlinkio/shlink-web-client.svg?style=flat-square)](https://github.com/shlinkio/shlink-web-client/releases/latest)
+[![GitHub license](https://img.shields.io/github/license/shlinkio/shlink-web-client.svg?style=flat-square)](https://github.com/shlinkio/shlink-web-client/blob/master/LICENSE)
 
 A ReactJS-based progressive web application for [Shlink](https://shlink.io).
 
diff --git a/package.json b/package.json
index 0cac2465..a36e97c1 100644
--- a/package.json
+++ b/package.json
@@ -69,6 +69,7 @@
     "jest": "20.0.4",
     "node-sass": "^4.9.0",
     "object-assign": "4.1.1",
+    "ocular.js": "^0.1.0",
     "postcss-flexbugs-fixes": "3.2.0",
     "postcss-loader": "2.0.8",
     "raf": "3.4.0",
@@ -85,6 +86,13 @@
     "whatwg-fetch": "2.0.3"
   },
   "jest": {
+    "coverageReporters": [
+      "text",
+      "text-summary",
+      "clover",
+      "html"
+    ],
+    "coverageDirectory": "<rootDir>/coverage",
     "collectCoverageFrom": [
       "src/**/*.{js,jsx,mjs}"
     ],
diff --git a/yarn.lock b/yarn.lock
index 83c8e9b1..262894d5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1691,6 +1691,10 @@ commander@^2.11.0:
   version "2.17.0"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.0.tgz#9d07b25e2a6f198b76d8b756a0e8a9604a6a1a60"
 
+commander@^2.9.0:
+  version "2.17.1"
+  resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
+
 commondir@^1.0.1:
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
@@ -5313,6 +5317,12 @@ obuf@^1.0.0, obuf@^1.1.1:
   version "1.1.2"
   resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e"
 
+ocular.js@^0.1.0:
+  version "0.1.0"
+  resolved "https://registry.yarnpkg.com/ocular.js/-/ocular.js-0.1.0.tgz#3a146ab59864e97ffb12f83e1d8f03b9abf9a866"
+  dependencies:
+    commander "^2.9.0"
+
 on-finished@~2.3.0:
   version "2.3.0"
   resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"