From 0ca5a67d0b4032c0243225c289a6c7986f09c770 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 21 Jun 2021 10:41:32 +0200 Subject: [PATCH] ci(test): store junit results for unit tests (#4787) * ci(test): store junit results for unit tests inspired by https://github.com/algolia/npm-search/pull/626 by @bodinsamuel * chore: jest subfolder --- .circleci/config.yml | 2 ++ .gitignore | 3 ++- jest.config.js | 14 ++++++++++++++ package.json | 1 + yarn.lock | 19 +++++++++++++++++-- 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d65541fa6..64cd6644be 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,6 +84,8 @@ jobs: - run: name: Unit tests command: yarn run test --maxWorkers=4 + - store_test_results: + path: junit/jest/ 'e2e tests': <<: *defaults diff --git a/.gitignore b/.gitignore index 792a2c87af..0b3c5268a6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,6 @@ yarn-error.log /website/stories /storybook/dist/* -# Argos CI screenshots +# Test output /functional-tests/screenshots/ +/junit diff --git a/jest.config.js b/jest.config.js index bb57b9e058..b35a492dde 100644 --- a/jest.config.js +++ b/jest.config.js @@ -25,4 +25,18 @@ module.exports = { globals: { __DEV__: true, }, + + // reporter for circleci + reporters: [ + 'default', + [ + 'jest-junit', + { + outputDirectory: 'junit/jest', + suiteNameTemplate: '{filepath}', + ancestorSeparator: ' › ', + addFileAttribute: 'true', + }, + ], + ], }; diff --git a/package.json b/package.json index 33868fc4f6..eb02a4d174 100644 --- a/package.json +++ b/package.json @@ -123,6 +123,7 @@ "jest-diff": "26.6.2", "jest-environment-jsdom": "26.6.2", "jest-environment-jsdom-global": "2.0.4", + "jest-junit": "12.2.0", "jest-watch-typeahead": "0.6.2", "jscodeshift": "0.7.0", "jsdom-global": "3.0.2", diff --git a/yarn.lock b/yarn.lock index 1538973603..34b9523538 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9264,6 +9264,16 @@ jest-jasmine2@^26.6.3: pretty-format "^26.6.2" throat "^5.0.0" +jest-junit@12.2.0: + version "12.2.0" + resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-12.2.0.tgz#cff7f9516e84f8e30f6bdea04cd84db6b095a376" + integrity sha512-ecGzF3KEQwLbMP5xMO7wqmgmyZlY/5yWDvgE/vFa+/uIT0KsU5nluf0D2fjIlOKB+tb6DiuSSpZuGpsmwbf7Fw== + dependencies: + mkdirp "^1.0.4" + strip-ansi "^5.2.0" + uuid "^8.3.2" + xml "^1.0.1" + jest-leak-detector@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz#7717cf118b92238f2eba65054c8a0c9c653a91af" @@ -10508,7 +10518,7 @@ mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -mkdirp@^1.0.0: +mkdirp@^1.0.0, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== @@ -14789,7 +14799,7 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== -uuid@^8.3.0: +uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== @@ -15257,6 +15267,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.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"