瀏覽代碼

Try adding coverage

Saul Shanabrook 6 年之前
父節點
當前提交
2875977428
共有 3 個文件被更改,包括 84 次插入80 次删除
  1. 82 73
      azure-pipelines.yml
  2. 0 6
      jupyterlab/tests/test_app.py
  3. 2 1
      testutils/src/jest-config.ts

+ 82 - 73
azure-pipelines.yml

@@ -1,80 +1,89 @@
 # https://aka.ms/yaml
 
 jobs:
-- job: 'Travis'
-  pool:
-    vmImage: 'ubuntu-16.04' # other options: 'macOS-10.13', 'vs2017-win2016'
-  variables:
-    python.version: '3.6'
-    gh.ref: github.com/jupyterlab/jupyterlab.git
-  strategy:
-    matrix:
-      JS:
-        group: 'js'
-      Integrity:
-        group: 'integrity'
-      Python:
-        group: 'python'
-      CLI:
-        group: 'cli'
-        python.version: '3.5'
-      Docs:
-        group: 'docs'
+  - job: 'Travis'
+    pool:
+      vmImage: 'ubuntu-16.04' # other options: 'macOS-10.13', 'vs2017-win2016'
+    variables:
+      python.version: '3.6'
+      gh.ref: github.com/jupyterlab/jupyterlab.git
+    strategy:
+      matrix:
+        JS:
+          group: 'js'
+        Integrity:
+          group: 'integrity'
+        Python:
+          group: 'python'
+        CLI:
+          group: 'cli'
+          python.version: '3.5'
+        Docs:
+          group: 'docs'
 
-  steps:
-  - task: UsePythonVersion@0
-    inputs:
-      versionSpec: '$(python.version)'
-      architecture: 'x64'
+    steps:
+      - task: UsePythonVersion@0
+        inputs:
+          versionSpec: '$(python.version)'
+          architecture: 'x64'
 
-  - task: Bash@3
-    displayName: 'install'
-    inputs:
-      targetType: 'filePath'
-      filePath: ./scripts/travis_install.sh
-  - script: python -m pip install virtualenv
-  - task: Bash@3
-    displayName: 'script'
-    inputs:
-      targetType: 'filePath'
-      filePath: ./scripts/travis_script.sh
-  - task: PublishTestResults@2
-    inputs:
-      testResultsFiles: '**/junit.xml'
-      testRunTitle: '$(group)'
-  - task: Bash@3
-    displayName: 'after_success'
-    inputs:
-      targetType: 'filePath'
-      filePath: ./scripts/travis_after_success.sh
-- job: 'Appveyor'
-  pool:
-    vmImage: 'vs2017-win2016'
-  variables:
-    python.version: '3.6'
-  strategy:
-    matrix:
-      JS:
-        name: 'javascript'
-        python.version: '3.5'
-      Python:
-        name: 'python'
-      Integrity:
-        group: 'integrity'
+      - task: Bash@3
+        displayName: 'install'
+        inputs:
+          targetType: 'filePath'
+          filePath: ./scripts/travis_install.sh
+      - script: python -m pip install virtualenv
+      - task: Bash@3
+        displayName: 'script'
+        inputs:
+          targetType: 'filePath'
+          filePath: ./scripts/travis_script.sh
+      - task: PublishTestResults@2
+        condition: always
+        inputs:
+          testResultsFiles: '**/junit.xml'
+          testRunTitle: '$(group)'
+      - task: PublishCodeCoverageResults@1
+        condition: always
+        inputs:
+          codeCoverageTool: Cobertura
+          summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
+          reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
+      - task: Bash@3
+        displayName: 'after_success'
+        inputs:
+          targetType: 'filePath'
+          filePath: ./scripts/travis_after_success.sh
 
-  steps:
-  - task: UsePythonVersion@0
-    inputs:
-      versionSpec: '$(python.version)'
-      architecture: 'x64'
+  - job: 'Appveyor'
+    pool:
+      vmImage: 'vs2017-win2016'
+    variables:
+      python.version: '3.6'
+    strategy:
+      matrix:
+        JS:
+          name: 'javascript'
+          python.version: '3.5'
+        Python:
+          name: 'python'
+        Integrity:
+          group: 'integrity'
 
-  - script: 'python -m pip install -U pip'
-  - script: 'pip install --upgrade -e ".[test]"'
-  - script: 'jupyter kernelspec list'
-  - script: 'jlpm versions'
-  - script: 'jlpm config current'
-  - script: cmd /E:ON /V:ON /C .\\scripts\\appveyor.cmd
-  - task: PublishTestResults@2
-    inputs:
-      testResultsFiles: '**/junit.xml'
-      testRunTitle: '$(group)'
+    steps:
+      - task: UsePythonVersion@0
+        inputs:
+          versionSpec: '$(python.version)'
+          architecture: 'x64'
+
+      - script: 'python -m pip install -U pip'
+      - script: 'pip install --upgrade -e ".[test]"'
+      - script: 'jupyter kernelspec list'
+      - script: 'jlpm versions'
+      - script: 'jlpm config current'
+      - script: cmd /E:ON /V:ON /C .\\scripts\\appveyor.cmd
+      - task: PublishTestResults@2
+        condition: always
+        inputs:
+          testResultsFiles: '**/junit.xml'
+          testRunTitle: '$(group)'

+ 0 - 6
jupyterlab/tests/test_app.py

@@ -194,15 +194,12 @@ 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)
@@ -248,9 +245,6 @@ class JestApp(ProcessTestApp):
         else:
             cmd += [jest]
 
-        if self.junit:
-            cmd += ["--reporters=default", "--reporters=jest-junit"]
-
         if self.testPathPattern:
             cmd += ['--testPathPattern', self.testPathPattern]
 

+ 2 - 1
testutils/src/jest-config.ts

@@ -14,11 +14,12 @@ module.exports = function(name: string, baseDir: string) {
     testPathIgnorePatterns: ['/dev_mode/', '/lib/', '/node_modules/'],
     moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
     rootDir: path.resolve(path.join(baseDir, '..', '..')),
+    reporters: ['default', 'jest-junit'],
     collectCoverageFrom: [
       `packages/${name}/src/**.{ts,tsx}`,
       `!packages/${name}/src/*.d.ts`
     ],
-    coverageReporters: ['json', 'lcov', 'text', 'html'],
+    coverageReporters: ['json', 'lcov', 'text', 'html', 'cobertura'],
     coverageDirectory: path.join(baseDir, 'coverage'),
     testRegex: `tests\/test-${name}\/src\/.*\.spec\.ts$`,
     globals: {