Browse Source

Report junit on jest tests

Saul Shanabrook 6 years ago
parent
commit
fd61343fd1

+ 2 - 0
.gitignore

@@ -42,3 +42,5 @@ examples/app/themes
 examples/app/schemas
 
 lerna-debug.log
+
+junit.xml

+ 7 - 4
azure-pipelines.yml

@@ -40,9 +40,8 @@ jobs:
       filePath: ./scripts/travis_script.sh
   - task: PublishTestResults@2
     inputs:
-      testResultsFiles: '**/test-*.xml'
-      testRunTitle: 'pytest'
-    condition: eq(variables['group'], 'python')
+      testResultsFiles: '**/junit.xml'
+      testRunTitle: '$(group)'
   - task: Bash@3
     displayName: 'after_success'
     inputs:
@@ -74,4 +73,8 @@ jobs:
   - script: 'jupyter kernelspec list'
   - script: 'jlpm versions'
   - script: 'jlpm config current'
-  - script: cmd /E:ON /V:ON /C .\\scripts\\appveyor.cmd
+  - script: cmd /E:ON /V:ON /C .\\scripts\\appveyor.cmd
+  - task: PublishTestResults@2
+    inputs:
+      testResultsFiles: '**/junit.xml'
+      testRunTitle: '$(group)'

+ 7 - 1
jupyterlab/tests/test_app.py

@@ -194,12 +194,15 @@ jest_flags['watchAll'] = (
     'Watch all test files'
 )
 
+AZURE_PIPELINES = bool(os.environ.get("AGENT_OS", False))
 
 class JestApp(ProcessTestApp):
     """A notebook app that runs a jest test."""
 
     coverage = Bool(False, help='Whether to run coverage').tag(config=True)
 
+    junit = Bool(AZURE_PIPELINES, help='Whether to export junit').tag(config=True)
+
     testPathPattern = Unicode('').tag(config=True)
 
     testNamePattern = Unicode('').tag(config=True)
@@ -237,7 +240,7 @@ class JestApp(ProcessTestApp):
         if self.coverage:
             cmd += [jest, '--coverage']
         elif debug:
-            cmd += ['--inspect-brk', jest,  '--no-cache']
+            cmd += ['--inspect-brk', jest, '--no-cache']
             if self.watchAll:
                 cmd += ['--watchAll']
             else:
@@ -245,6 +248,9 @@ class JestApp(ProcessTestApp):
         else:
             cmd += [jest]
 
+        if self.junit:
+            cmd += ["--reporters=default", "--reporters=jest-junit"]
+
         if self.testPathPattern:
             cmd += ['--testPathPattern', self.testPathPattern]
 

+ 1 - 1
scripts/travis_script.sh

@@ -11,7 +11,7 @@ python -c "from jupyterlab.commands import build_check; build_check()"
 
 if [[ $GROUP == python ]]; then
     # Run the python tests
-    py.test -v --junitxml=junit/test-results.xml
+    py.test -v --junitxml=junit.xml
 fi
 
 

+ 1 - 0
tests/test-application/package.json

@@ -22,6 +22,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "simulate-event": "~1.4.0",
     "ts-jest": "^23.1.4"
   },

+ 1 - 0
tests/test-apputils/package.json

@@ -23,6 +23,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "react": "~16.4.2",
     "simulate-event": "~1.4.0",
     "ts-jest": "^23.1.4"

+ 1 - 0
tests/test-cells/package.json

@@ -23,6 +23,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-codeeditor/package.json

@@ -20,6 +20,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "simulate-event": "~1.4.0",
     "ts-jest": "^23.1.4"
   },

+ 1 - 0
tests/test-codemirror/package.json

@@ -17,6 +17,7 @@
     "@jupyterlab/testutils": "^0.3.1",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "simulate-event": "~1.4.0",
     "ts-jest": "^23.1.4"
   },

+ 1 - 0
tests/test-completer/package.json

@@ -23,6 +23,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "simulate-event": "~1.4.0",
     "ts-jest": "^23.1.4"
   },

+ 1 - 0
tests/test-coreutils/package.json

@@ -18,6 +18,7 @@
     "@phosphor/signaling": "^1.2.2",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-docregistry/package.json

@@ -23,6 +23,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-fileeditor/package.json

@@ -22,6 +22,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "simulate-event": "~1.4.0",
     "ts-jest": "^23.1.4"
   },

+ 1 - 0
tests/test-imageviewer/package.json

@@ -21,6 +21,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-inspector/package.json

@@ -18,6 +18,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-mainmenu/package.json

@@ -20,6 +20,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-observables/package.json

@@ -18,6 +18,7 @@
     "@phosphor/coreutils": "^1.3.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-outputarea/package.json

@@ -21,6 +21,7 @@
     "@phosphor/widgets": "^1.6.0",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "ts-jest": "^23.1.4"
   },
   "devDependencies": {

+ 1 - 0
tests/test-services/package.json

@@ -20,6 +20,7 @@
     "@phosphor/signaling": "^1.2.2",
     "chai": "~4.1.2",
     "jest": "^23.5.0",
+    "jest-junit": "^5.2.0",
     "node-fetch": "~2.2.0",
     "text-encoding": "~0.5.5",
     "ts-jest": "^23.1.4",

+ 131 - 0
yarn.lock

@@ -1518,6 +1518,13 @@ 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"
+  dependencies:
+    babel-plugin-istanbul "^4.1.6"
+    babel-preset-jest "^23.2.0"
+
 babel-messages@^6.23.0:
   version "6.23.0"
   resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e"
@@ -3694,6 +3701,17 @@ 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"
+  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"
+
 extend-shallow@^2.0.1:
   version "2.0.1"
   resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@@ -5370,6 +5388,25 @@ 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"
+  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.npmjs.org/jest-diff/-/jest-diff-23.5.0.tgz#250651a433dd0050290a07642946cc9baaf06fba"
@@ -5379,6 +5416,15 @@ 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"
+  dependencies:
+    chalk "^2.0.1"
+    diff "^3.2.0"
+    jest-get-type "^22.1.0"
+    pretty-format "^23.6.0"
+
 jest-docblock@^21.0.0:
   version "21.2.0"
   resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414"
@@ -5396,6 +5442,13 @@ 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"
+  dependencies:
+    chalk "^2.0.1"
+    pretty-format "^23.6.0"
+
 jest-environment-jsdom@^23.4.0:
   version "23.4.0"
   resolved "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-23.4.0.tgz#056a7952b3fea513ac62a140a2c368c79d9e6023"
@@ -5445,6 +5498,33 @@ 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"
+  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.2.0:
+  version "5.2.0"
+  resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-5.2.0.tgz#980401db7aa69999cf117c6d740a8135c22ae379"
+  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.npmjs.org/jest-leak-detector/-/jest-leak-detector-23.5.0.tgz#14ac2a785bd625160a2ea968fd5d98b7dcea3e64"
@@ -5459,6 +5539,14 @@ 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"
+  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.npmjs.org/jest-message-util/-/jest-message-util-23.4.0.tgz#17610c50942349508d01a3d1e0bda2c079086a9f"
@@ -5492,6 +5580,14 @@ 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"
+  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.npmjs.org/jest-runner/-/jest-runner-23.5.0.tgz#570f7a044da91648b5bb9b6baacdd511076c71d7"
@@ -5555,6 +5651,21 @@ 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"
+  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.npmjs.org/jest-util/-/jest-util-23.4.0.tgz#4d063cb927baf0a23831ff61bec2cbbf49793561"
@@ -5568,6 +5679,15 @@ 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"
+  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.npmjs.org/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231"
@@ -7814,6 +7934,13 @@ pretty-format@^23.5.0:
     ansi-regex "^3.0.0"
     ansi-styles "^3.2.0"
 
+pretty-format@^23.6.0:
+  version "23.6.0"
+  resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.6.0.tgz#5eaac8eeb6b33b987b7fe6097ea6a8a146ab5760"
+  dependencies:
+    ansi-regex "^3.0.0"
+    ansi-styles "^3.2.0"
+
 private@^0.1.8, private@~0.1.5:
   version "0.1.8"
   resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
@@ -10506,6 +10633,10 @@ xml-name-validator@^3.0.0:
   version "3.0.0"
   resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
 
+xml@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
+
 xmlhttprequest-ssl@~1.5.4:
   version "1.5.5"
   resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e"