Add JUnit report to Jest front-end tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-01-12 19:47:10 +01:00
parent fde367568d
commit b70321e377
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
5 changed files with 37 additions and 22 deletions

2
.gitignore vendored
View File

@ -40,3 +40,5 @@ release/
*.po~ *.po~
.weblate .weblate
docker/production/.env docker/production/.env
test-junit-report.xml
js/junit.xml

View File

@ -28,7 +28,6 @@ variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}" PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
ARCH: "amd64" ARCH: "amd64"
cache: cache:
key: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" key: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
paths: paths:
@ -45,9 +44,9 @@ cache:
install: install:
stage: install stage: install
script: script:
- yarn --cwd "js" install --frozen-lockfile - yarn --cwd "js" install --frozen-lockfile
- mix deps.get - mix deps.get
- mix compile - mix compile
lint-elixir: lint-elixir:
stage: check stage: check
@ -70,16 +69,16 @@ lint-front:
build-frontend: build-frontend:
stage: build stage: build
before_script: before_script:
- apt update - apt update
- apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant - apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant
script: script:
- yarn --cwd "js" run build - yarn --cwd "js" run build
artifacts: artifacts:
expire_in: 5 days expire_in: 5 days
paths: paths:
- priv/static - priv/static
needs: needs:
- lint-front - lint-front
deps: deps:
stage: check stage: check
@ -109,8 +108,6 @@ jest:
stage: test stage: test
needs: needs:
- lint-front - lint-front
before_script:
- yarn add --dev jest-junit
script: script:
- yarn --cwd "js" run test:unit --no-color --ci --reporters=default --reporters=jest-junit - yarn --cwd "js" run test:unit --no-color --ci --reporters=default --reporters=jest-junit
artifacts: artifacts:
@ -119,7 +116,7 @@ jest:
- js/coverage - js/coverage
reports: reports:
junit: junit:
- js/junit.xml - js/junit.xml
expire_in: 30 days expire_in: 30 days
# cypress: # cypress:
@ -193,20 +190,20 @@ build-docker-tag:
package-app: package-app:
stage: package stage: package
before_script: before_script:
- apt update - apt update
- apt install -y --no-install-recommends build-essential git cmake - apt install -y --no-install-recommends build-essential git cmake
variables: variables:
MIX_ENV: "prod" MIX_ENV: "prod"
script: script:
- mix local.hex --force - mix local.hex --force
- mix local.rebar --force - mix local.rebar --force
- cp docker/production/releases.exs ./config/ - cp docker/production/releases.exs ./config/
- mix phx.digest - mix phx.digest
- mix release - mix release
artifacts: artifacts:
expire_in: 2 days expire_in: 2 days
paths: paths:
- _build/prod/rel - _build/prod/rel
release-upload: release-upload:
stage: upload stage: upload
@ -242,4 +239,3 @@ release-create:
release-cli create --name "$CI_PROJECT_TITLE v$CI_COMMIT_TAG" \ release-cli create --name "$CI_PROJECT_TITLE v$CI_COMMIT_TAG" \
--tag-name "$CI_COMMIT_TAG" \ --tag-name "$CI_COMMIT_TAG" \
--assets-link "{\"name\":\"${APP_ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_VERSION}/${APP_ASSET}\"}" --assets-link "{\"name\":\"${APP_ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_VERSION}/${APP_ASSET}\"}"

View File

@ -7,6 +7,7 @@ module.exports = {
"!get_union_json.ts", "!get_union_json.ts",
], ],
coverageReporters: ["html", "text", "text-summary"], 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 // The following should fix the issue with svgs and ?inline loader (see Logo.vue), but doesn't work
// //
// transform: { // transform: {

View File

@ -82,6 +82,7 @@
"eslint-config-prettier": "^7.0.0", "eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0", "eslint-plugin-vue": "^7.0.0",
"jest-junit": "^12.0.0",
"mock-apollo-client": "^0.4", "mock-apollo-client": "^0.4",
"prettier": "2.2.1", "prettier": "2.2.1",
"prettier-eslint": "^12.0.0", "prettier-eslint": "^12.0.0",

View File

@ -7172,6 +7172,16 @@ jest-jasmine2@^24.9.0:
pretty-format "^24.9.0" pretty-format "^24.9.0"
throat "^4.0.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: jest-leak-detector@^24.9.0:
version "24.9.0" version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" 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" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= 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" version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== 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" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== 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: xmlchars@^2.1.1:
version "2.2.0" version "2.2.0"
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"