From 38382b40355f9d661e6950452013808dd77e21f0 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Wed, 8 Mar 2023 20:50:50 +0100
Subject: [PATCH] Added coverage report

---
 .gitlab-ci.yml      | 2 +-
 Makefile            | 1 +
 fda-ui/.gitignore   | 1 +
 fda-ui/.nycrc       | 2 +-
 fda-ui/package.json | 2 +-
 5 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2e0ea547e4..1967e4afea 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -298,7 +298,7 @@ test-frontend:
     - build-frontend
   script:
     - "make test-frontend"
-    - "cat ./fda-analyse-service/coverage.txt | grep -o 'TOTAL[^%]*%'"
+    - "cat ./fda-ui/coverage.txt | grep -o 'Lines[^%]*%'"
   artifacts:
     when: always
     paths:
diff --git a/Makefile b/Makefile
index 66f7d69cf3..a5bce8de2e 100644
--- a/Makefile
+++ b/Makefile
@@ -190,6 +190,7 @@ coverage-frontend: build-frontend
 test-frontend: clean build-frontend
 	yarn --cwd ./fda-ui install
 	yarn --cwd ./fda-ui run test:unit || true
+	yarn --cwd ./fda-ui run coverage || true
 
 clean:
 	docker system prune -f --volumes
diff --git a/fda-ui/.gitignore b/fda-ui/.gitignore
index 6e6e590a03..a6a8dd571f 100644
--- a/fda-ui/.gitignore
+++ b/fda-ui/.gitignore
@@ -21,6 +21,7 @@ lib-cov
 
 # Coverage directory used by tools like istanbul
 coverage/
+coverage.txt
 
 # nyc test coverage
 .nyc_output
diff --git a/fda-ui/.nycrc b/fda-ui/.nycrc
index ccda5111b9..a4841b7947 100644
--- a/fda-ui/.nycrc
+++ b/fda-ui/.nycrc
@@ -6,7 +6,7 @@
   "branches": 35,
   "check-coverage": true,
   "include": [ "components/**/*.vue", "layouts/**/*.vue", "pages/**/*.vue", "server-middleware/**/*.js", "store/**/*.js"],
-  "exclude": ["node_modules"],
+  "exclude": ["node_modules", "server-middleware", "store"],
   "extension": [".js", ".vue"],
   "reporter": [
     "lcov",
diff --git a/fda-ui/package.json b/fda-ui/package.json
index bb9ddae2dc..1649177b07 100644
--- a/fda-ui/package.json
+++ b/fda-ui/package.json
@@ -12,7 +12,7 @@
     "ver": "nuxt --version",
     "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
     "lint": "yarn lint:js",
-    "coverage": "nyc ava test/unit/**/* test/specs/**/*",
+    "coverage": "nyc ava test/unit/**/* test/specs/**/* > ./coverage.txt",
     "test:unit": "ava test/unit/**/* test/specs/**/*",
     "test:watch": "ava --watch test/unit/**/* test/specs/**/*",
     "test:e2e": "yarn clean && cross-env PORT=3001 ava --timeout=2h --fail-fast test/e2e/**",
-- 
GitLab