From b70321e377b5997a46fc7a505bd2d3826dfe7aa0 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 12 Jan 2021 19:47:10 +0100 Subject: [PATCH] Add JUnit report to Jest front-end tests Signed-off-by: Thomas Citharel --- .gitignore | 2 ++ .gitlab-ci.yml | 38 +++++++++++++++++--------------------- js/jest.config.js | 1 + js/package.json | 1 + js/yarn.lock | 17 ++++++++++++++++- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 8791c51f5..e8659535c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ release/ *.po~ .weblate docker/production/.env +test-junit-report.xml +js/junit.xml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c976eaa3f..4ef995531 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,6 @@ variables: PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}" ARCH: "amd64" - cache: key: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" paths: @@ -45,9 +44,9 @@ cache: install: stage: install script: - - yarn --cwd "js" install --frozen-lockfile - - mix deps.get - - mix compile + - yarn --cwd "js" install --frozen-lockfile + - mix deps.get + - mix compile lint-elixir: stage: check @@ -70,16 +69,16 @@ lint-front: build-frontend: stage: build before_script: - - apt update - - apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant + - apt update + - apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant script: - - yarn --cwd "js" run build + - yarn --cwd "js" run build artifacts: expire_in: 5 days paths: - - priv/static + - priv/static needs: - - lint-front + - lint-front deps: stage: check @@ -109,8 +108,6 @@ jest: stage: test needs: - lint-front - before_script: - - yarn add --dev jest-junit script: - yarn --cwd "js" run test:unit --no-color --ci --reporters=default --reporters=jest-junit artifacts: @@ -119,7 +116,7 @@ jest: - js/coverage reports: junit: - - js/junit.xml + - js/junit.xml expire_in: 30 days # cypress: @@ -193,20 +190,20 @@ build-docker-tag: package-app: stage: package before_script: - - apt update - - apt install -y --no-install-recommends build-essential git cmake + - apt update + - apt install -y --no-install-recommends build-essential git cmake variables: MIX_ENV: "prod" script: - - mix local.hex --force - - mix local.rebar --force - - cp docker/production/releases.exs ./config/ - - mix phx.digest - - mix release + - mix local.hex --force + - mix local.rebar --force + - cp docker/production/releases.exs ./config/ + - mix phx.digest + - mix release artifacts: expire_in: 2 days paths: - - _build/prod/rel + - _build/prod/rel release-upload: stage: upload @@ -242,4 +239,3 @@ release-create: release-cli create --name "$CI_PROJECT_TITLE v$CI_COMMIT_TAG" \ --tag-name "$CI_COMMIT_TAG" \ --assets-link "{\"name\":\"${APP_ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_VERSION}/${APP_ASSET}\"}" - diff --git a/js/jest.config.js b/js/jest.config.js index b10500065..a87688fe7 100644 --- a/js/jest.config.js +++ b/js/jest.config.js @@ -7,6 +7,7 @@ module.exports = { "!get_union_json.ts", ], coverageReporters: ["html", "text", "text-summary"], + reporters: ["default", "jest-junit"], // The following should fix the issue with svgs and ?inline loader (see Logo.vue), but doesn't work // // transform: { diff --git a/js/package.json b/js/package.json index 4b9a6510f..047c40726 100644 --- a/js/package.json +++ b/js/package.json @@ -82,6 +82,7 @@ "eslint-config-prettier": "^7.0.0", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-vue": "^7.0.0", + "jest-junit": "^12.0.0", "mock-apollo-client": "^0.4", "prettier": "2.2.1", "prettier-eslint": "^12.0.0", diff --git a/js/yarn.lock b/js/yarn.lock index c831fde31..9de09df89 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -7172,6 +7172,16 @@ jest-jasmine2@^24.9.0: pretty-format "^24.9.0" throat "^4.0.0" +jest-junit@^12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-12.0.0.tgz#3ebd4a6a84b50c4ab18323a8f7d9cceb9d845df6" + integrity sha512-+8K35LlboWiPuCnXSyiid7rFdxNlpCWWM20WEYe6IZH6psfUWKZmSpSRQ5tk0C0cBeDsvsnIzcef5mYhyJsbug== + dependencies: + mkdirp "^1.0.4" + strip-ansi "^5.2.0" + uuid "^3.3.3" + xml "^1.0.1" + jest-leak-detector@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" @@ -12115,7 +12125,7 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= -uuid@^3.3.2, uuid@^3.4.0: +uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== @@ -12859,6 +12869,11 @@ xml-name-validator@^3.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== +xml@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= + xmlchars@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"