diff --git a/.circleci/config.yml b/.circleci/config.yml index 97524acda7..12aa7a18ec 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,6 +105,10 @@ jobs: - run: name: Build Fixtures command: yarn test:fixtures -i --coverage && yarn coverage -F fixtures + environment: + JEST_JUNIT_OUTPUT_NAME: fixtures.xml + - store_test_results: + path: reports/junit - persist_to_workspace: root: ~/project paths: @@ -132,6 +136,10 @@ jobs: - run: name: Unit Tests command: yarn test:unit -w=2 --coverage && yarn coverage -F unit + environment: + JEST_JUNIT_OUTPUT_NAME: unit.xml + - store_test_results: + path: reports/junit test-e2e: <<: *defaults @@ -151,6 +159,10 @@ jobs: - run: name: E2E Tests command: CHROME_PATH=/bin/chromium yarn test:e2e && yarn coverage -F e2e + environment: + JEST_JUNIT_OUTPUT_NAME: e2e.xml + - store_test_results: + path: reports/junit test-types: <<: *defaults diff --git a/.gitignore b/.gitignore index 48e44e9bb0..86a8924ae1 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ distributions/*/LICENSE # Dist folders dist +# Junit reports +reports + # Coverage reports coverage *.lcov diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 30703f5a4f..48ae3dceec 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,9 +20,15 @@ steps: displayName: 'Install dependencies' - script: | - set NODE_OPTIONS=--max_old_space_size=4096 && yarn test:fixtures -i + set JEST_JUNIT_OUTPUT_NAME=fixtures.xml && set NODE_OPTIONS=--max_old_space_size=4096 && yarn test:fixtures -i displayName: 'Test: Build Fixtures' - script: | - set NODE_OPTIONS=--max_old_space_size=4096 && yarn test:unit -w=2 + set JEST_JUNIT_OUTPUT_NAME=unit.xml && set NODE_OPTIONS=--max_old_space_size=4096 && yarn test:unit -w=2 displayName: 'Test: Run unit tests' + +- task: PublishTestResults@2 + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: 'reports/junit/*' + displayName: 'Publish test results to Azure Pipelines' diff --git a/jest.config.js b/jest.config.js index 9cd8cde07a..6d32ff11ae 100644 --- a/jest.config.js +++ b/jest.config.js @@ -43,5 +43,10 @@ module.exports = { 'ts', 'js', 'json' + ], + + reporters: [ + 'default', + ['jest-junit', { outputDirectory: 'reports/junit' }] ] } diff --git a/package.json b/package.json index e26b695d48..9a82af6930 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "glob": "^7.1.4", "is-wsl": "^2.0.0", "jest": "^24.8.0", + "jest-junit": "^6.4.0", "jsdom": "^15.1.0", "klaw-sync": "^6.0.0", "lerna": "^3.14.1", diff --git a/yarn.lock b/yarn.lock index 1321fd4546..cf728f57a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6407,6 +6407,16 @@ jest-jasmine2@^24.8.0: pretty-format "^24.8.0" throat "^4.0.0" +jest-junit@^6.4.0: + version "6.4.0" + resolved "https://registry.npmjs.org/jest-junit/-/jest-junit-6.4.0.tgz#23e15c979fa6338afde46f2d2ac2a6b7e8cf0d9e" + integrity sha512-GXEZA5WBeUich94BARoEUccJumhCgCerg7mXDFLxWwI2P7wL3Z7sGWk+53x343YdBLjiMR9aD/gYMVKO+0pE4Q== + dependencies: + jest-validate "^24.0.0" + mkdirp "^0.5.1" + strip-ansi "^4.0.0" + xml "^1.0.1" + jest-leak-detector@^24.8.0: version "24.8.0" resolved "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz#c0086384e1f650c2d8348095df769f29b48e6980" @@ -6570,7 +6580,7 @@ jest-util@^24.8.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.8.0: +jest-validate@^24.0.0, jest-validate@^24.8.0: version "24.8.0" resolved "https://registry.npmjs.org/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" integrity sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA== @@ -11652,6 +11662,11 @@ xml-name-validator@^3.0.0: resolved "https://registry.npmjs.org/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.npmjs.org/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= + xmlchars@^1.3.1: version "1.3.1" resolved "https://registry.npmjs.org/xmlchars/-/xmlchars-1.3.1.tgz#1dda035f833dbb4f86a0c28eaa6ca769214793cf"