Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage and publish on Azure Devops #6213

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build/.mocha.unittests.js.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--require source-map-support/register
--require out/test/unittests.js
--reporter mocha-multi-reporters
--reporter-options configFile=build/.mocha-multi-reporters.config
--ui tdd
--recursive
--colors
./out/test/**/*.unit.test.js
8 changes: 8 additions & 0 deletions build/.mocha.unittests.ts.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--require ts-node/register
--require out/test/unittests.js
--reporter mocha-multi-reporters
--reporter-options configFile=build/.mocha-multi-reporters.config
--ui tdd
--recursive
--colors
./src/test/**/*.unit.test.ts
10 changes: 10 additions & 0 deletions build/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"reporter": ["lcov", "html", "text", "text-summary", "cobertura"],
"include": [
"src/client/**/*.ts", "src/test/**/*.js",
"src/datascience-ui/**/*.ts", "src/datascience-ui/**/*.js"
],
"exclude": ["src/test/**/*.ts", "src/test/**/*.js"]
}
17 changes: 13 additions & 4 deletions build/ci/templates/test_phases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,31 @@ steps:
# This will only run if the string 'testUnitTests' exists in variable `TestsToRun`
#
# Example command line (windows pwsh):
# > npm run test:unittests
# > npm run test:unittests:cover
- bash: |
npm run test:unittests
displayName: 'run test:unittest'
npm run test:unittests:cover
displayName: 'run test:unittests'
condition: and(succeeded(), contains(variables['TestsToRun'], 'testUnitTests'))

# Upload the test results to Azure DevOps to facilitate test reporting in their UX.
- task: PublishTestResults@2
displayName: 'Publish test:unittest results'
displayName: 'Publish test:unittests results'
condition: contains(variables['TestsToRun'], 'testUnitTests')
inputs:
testResultsFiles: '$(MOCHA_FILE)'
testRunTitle: 'unittests-$(Agent.Os)-Py$(pythonVersion)'
buildPlatform: '$(Agent.Os)-Py$(pythonVersion)'
buildConfiguration: 'UnitTests'

# Publish Code Coverage Results
- task: PublishCodeCoverageResults@1
displayName: 'Publish test:unittests coverage results'
condition: contains(variables['TestsToRun'], 'testUnitTests')
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: "$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/coverage"

# Install the requirements for the Python or the system tests. This includes the supporting libs that
# we ship in our extension such as PTVSD and Jedi.
#
Expand Down
1 change: 1 addition & 0 deletions news/3 Code Health/4472.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add code coverage reporting.
Loading