Skip to content

Commit

Permalink
test: Adding test report tasks to Azure pipelines (#10128)
Browse files Browse the repository at this point in the history
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->

**What kind of change does this PR introduce?**
<!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->
This PR is related to the issue #10103 
The PR helps to publish test results for reporting in Azure Pipelines.

**Summary**
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
<!-- Try to link to an open issue for more information. -->
Azure Pipelines provides excellent reporting capabilities that can be leveraged by this PR.
An example report is shown in the image below.
![image](https://user-images.githubusercontent.com/13175100/48767951-e8a73580-ecdd-11e8-8e6a-20d7767d7c1b.png)
A screenshot for code coverage : 
![image](https://user-images.githubusercontent.com/13175100/48795657-938e1280-ed23-11e8-88d0-bf94f610d774.png)


**Does this PR introduce a breaking change?**
No
  • Loading branch information
vagisha-nidhi authored and pieh committed Nov 26, 2018
1 parent bafdfec commit 7325fd9
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 3 deletions.
15 changes: 15 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,19 @@ steps:
displayName: "Install Node.js"

- script: yarn bootstrap

- script: yarn test

- task: PublishTestResults@2
displayName: "Publish Test Results"
condition: succeededOrFailed()
inputs:
testResultsFiles: "**junit*.xml"
testRunTitle: TestRun ${{ parameters.name }} $(node_version)

- task: PublishCodeCoverageResults@1
displayName: "Publish code coverage results"
condition: succeededOrFailed()
inputs:
codeCoverageTool: "cobertura"
summaryFileLocation: "**/coverage/cobertura-coverage.xml"
5 changes: 3 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ module.exports = {
moduleNameMapper: {
"^highlight.js$": `<rootDir>/node_modules/highlight.js/lib/index.js`,
},
collectCoverage: false,
coverageReporters: [`json-summary`, `text`, `html`],
collectCoverage: true,
coverageReporters: [`json-summary`, `text`, `html`, `cobertura`],
coverageThreshold: {
global: {
lines: 45,
Expand All @@ -42,4 +42,5 @@ module.exports = {
},
},
collectCoverageFrom: coverageDirs,
reporters: [`default`, `jest-junit`],
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"glob": "^7.1.1",
"husky": "1.1.1",
"jest": "^23.5.0",
"jest-junit": "^5.0.0",
"jest-cli": "^23.5.0",
"lerna": "^3.3.0",
"lint-staged": "^8.0.4",
Expand Down
133 changes: 132 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2878,6 +2878,14 @@ babel-jest@^23.4.2:
babel-plugin-istanbul "^4.1.6"
babel-preset-jest "^23.2.0"

babel-jest@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.6.0.tgz#a644232366557a2240a0c083da6b25786185a2f1"
integrity sha512-lqKGG6LYXYu+DQh/slrQ8nxXQkEkhugdXsU6St7GmhVS7Ilc/22ArwqXNJrf0QaOBjZB0360qZMwXqDYQHXaew==
dependencies:
babel-plugin-istanbul "^4.1.6"
babel-preset-jest "^23.2.0"

babel-loader@8.0.0-beta.4:
version "8.0.0-beta.4"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.0-beta.4.tgz#c3fab00696c385c70c04dbe486391f0eb996f345"
Expand Down Expand Up @@ -7669,6 +7677,18 @@ expect@^23.5.0:
jest-message-util "^23.4.0"
jest-regex-util "^23.3.0"

expect@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/expect/-/expect-23.6.0.tgz#1e0c8d3ba9a581c87bd71fb9bc8862d443425f98"
integrity sha512-dgSoOHgmtn/aDGRVFWclQyPDKl2CQRq0hmIEoUAuQs/2rn2NcvCWcSCovm6BLeuB/7EZuLGu2QfnR+qRt5OM4w==
dependencies:
ansi-styles "^3.2.0"
jest-diff "^23.6.0"
jest-get-type "^22.1.0"
jest-matcher-utils "^23.6.0"
jest-message-util "^23.4.0"
jest-regex-util "^23.3.0"

express-graphql@^0.6.12:
version "0.6.12"
resolved "http://registry.npmjs.org/express-graphql/-/express-graphql-0.6.12.tgz#dfcb2058ca72ed5190b140830ad8cdbf76a9128a"
Expand Down Expand Up @@ -10937,6 +10957,26 @@ jest-config@^23.5.0:
micromatch "^2.3.11"
pretty-format "^23.5.0"

jest-config@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.6.0.tgz#f82546a90ade2d8c7026fbf6ac5207fc22f8eb1d"
integrity sha512-i8V7z9BeDXab1+VNo78WM0AtWpBRXJLnkT+lyT+Slx/cbP5sZJ0+NDuLcmBE5hXAoK0aUp7vI+MOxR+R4d8SRQ==
dependencies:
babel-core "^6.0.0"
babel-jest "^23.6.0"
chalk "^2.0.1"
glob "^7.1.1"
jest-environment-jsdom "^23.4.0"
jest-environment-node "^23.4.0"
jest-get-type "^22.1.0"
jest-jasmine2 "^23.6.0"
jest-regex-util "^23.3.0"
jest-resolve "^23.6.0"
jest-util "^23.4.0"
jest-validate "^23.6.0"
micromatch "^2.3.11"
pretty-format "^23.6.0"

jest-diff@^23.5.0:
version "23.5.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.5.0.tgz#250651a433dd0050290a07642946cc9baaf06fba"
Expand All @@ -10947,6 +10987,16 @@ jest-diff@^23.5.0:
jest-get-type "^22.1.0"
pretty-format "^23.5.0"

jest-diff@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.6.0.tgz#1500f3f16e850bb3d71233408089be099f610c7d"
integrity sha512-Gz9l5Ov+X3aL5L37IT+8hoCUsof1CVYBb2QEkOupK64XyRR3h+uRpYIm97K7sY8diFxowR8pIGEdyfMKTixo3g==
dependencies:
chalk "^2.0.1"
diff "^3.2.0"
jest-get-type "^22.1.0"
pretty-format "^23.6.0"

jest-docblock@^23.2.0:
version "23.2.0"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-23.2.0.tgz#f085e1f18548d99fdd69b20207e6fd55d91383a7"
Expand All @@ -10962,6 +11012,14 @@ jest-each@^23.5.0:
chalk "^2.0.1"
pretty-format "^23.5.0"

jest-each@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.6.0.tgz#ba0c3a82a8054387016139c733a05242d3d71575"
integrity sha512-x7V6M/WGJo6/kLoissORuvLIeAoyo2YqLOoCDkohgJ4XOXSqOtyvr8FbInlAWS77ojBsZrafbozWoKVRdtxFCg==
dependencies:
chalk "^2.0.1"
pretty-format "^23.6.0"

jest-environment-jsdom@^23.4.0:
version "23.4.0"
resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-23.4.0.tgz#056a7952b3fea513ac62a140a2c368c79d9e6023"
Expand Down Expand Up @@ -11016,6 +11074,35 @@ jest-jasmine2@^23.5.0:
jest-util "^23.4.0"
pretty-format "^23.5.0"

jest-jasmine2@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.6.0.tgz#840e937f848a6c8638df24360ab869cc718592e0"
integrity sha512-pe2Ytgs1nyCs8IvsEJRiRTPC0eVYd8L/dXJGU08GFuBwZ4sYH/lmFDdOL3ZmvJR8QKqV9MFuwlsAi/EWkFUbsQ==
dependencies:
babel-traverse "^6.0.0"
chalk "^2.0.1"
co "^4.6.0"
expect "^23.6.0"
is-generator-fn "^1.0.0"
jest-diff "^23.6.0"
jest-each "^23.6.0"
jest-matcher-utils "^23.6.0"
jest-message-util "^23.4.0"
jest-snapshot "^23.6.0"
jest-util "^23.4.0"
pretty-format "^23.6.0"

jest-junit@^5.0.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-5.2.0.tgz#980401db7aa69999cf117c6d740a8135c22ae379"
integrity sha512-Mdg0Qpdh1Xm/FA1B/mcLlmEmlr3XzH5pZg7MvcAwZhjHijPRd1z/UwYwkwNHmCV7o4ZOWCf77nLu7ZkhHHrtJg==
dependencies:
jest-config "^23.6.0"
jest-validate "^23.0.1"
mkdirp "^0.5.1"
strip-ansi "^4.0.0"
xml "^1.0.1"

jest-leak-detector@^23.5.0:
version "23.5.0"
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.5.0.tgz#14ac2a785bd625160a2ea968fd5d98b7dcea3e64"
Expand All @@ -11032,6 +11119,15 @@ jest-matcher-utils@^23.5.0:
jest-get-type "^22.1.0"
pretty-format "^23.5.0"

jest-matcher-utils@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.6.0.tgz#726bcea0c5294261a7417afb6da3186b4b8cac80"
integrity sha512-rosyCHQfBcol4NsckTn01cdelzWLU9Cq7aaigDf8VwwpIRvWE/9zLgX2bON+FkEW69/0UuYslUe22SOdEf2nog==
dependencies:
chalk "^2.0.1"
jest-get-type "^22.1.0"
pretty-format "^23.6.0"

jest-message-util@^23.4.0:
version "23.4.0"
resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-23.4.0.tgz#17610c50942349508d01a3d1e0bda2c079086a9f"
Expand Down Expand Up @@ -11070,6 +11166,15 @@ jest-resolve@^23.5.0:
chalk "^2.0.1"
realpath-native "^1.0.0"

jest-resolve@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.6.0.tgz#cf1d1a24ce7ee7b23d661c33ba2150f3aebfa0ae"
integrity sha512-XyoRxNtO7YGpQDmtQCmZjum1MljDqUCob7XlZ6jy9gsMugHdN2hY4+Acz9Qvjz2mSsOnPSH7skBmDYCHXVZqkA==
dependencies:
browser-resolve "^1.11.3"
chalk "^2.0.1"
realpath-native "^1.0.0"

jest-runner@^23.5.0:
version "23.5.0"
resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.5.0.tgz#570f7a044da91648b5bb9b6baacdd511076c71d7"
Expand Down Expand Up @@ -11137,6 +11242,22 @@ jest-snapshot@^23.5.0:
pretty-format "^23.5.0"
semver "^5.5.0"

jest-snapshot@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.6.0.tgz#f9c2625d1b18acda01ec2d2b826c0ce58a5aa17a"
integrity sha512-tM7/Bprftun6Cvj2Awh/ikS7zV3pVwjRYU2qNYS51VZHgaAMBs5l4o/69AiDHhQrj5+LA2Lq4VIvK7zYk/bswg==
dependencies:
babel-types "^6.0.0"
chalk "^2.0.1"
jest-diff "^23.6.0"
jest-matcher-utils "^23.6.0"
jest-message-util "^23.4.0"
jest-resolve "^23.6.0"
mkdirp "^0.5.1"
natural-compare "^1.4.0"
pretty-format "^23.6.0"
semver "^5.5.0"

jest-util@^23.4.0:
version "23.4.0"
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-23.4.0.tgz#4d063cb927baf0a23831ff61bec2cbbf49793561"
Expand All @@ -11151,6 +11272,16 @@ jest-util@^23.4.0:
slash "^1.0.0"
source-map "^0.6.0"

jest-validate@^23.0.1, jest-validate@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.6.0.tgz#36761f99d1ed33fcd425b4e4c5595d62b6597474"
integrity sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A==
dependencies:
chalk "^2.0.1"
jest-get-type "^22.1.0"
leven "^2.1.0"
pretty-format "^23.6.0"

jest-validate@^23.5.0:
version "23.5.0"
resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231"
Expand Down Expand Up @@ -19984,7 +20115,7 @@ xml2js@^0.4.5:
sax ">=0.6.0"
xmlbuilder "~9.0.1"

xml@1.0.1:
xml@1.0.1, xml@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=
Expand Down

0 comments on commit 7325fd9

Please sign in to comment.