Skip to content

Commit b66b7a9

Browse files
authored
Merge pull request MicrosoftDocs#1 from vinodjo/master
Changes to include test and code coverage to the sample
2 parents 6363736 + df3c1d1 commit b66b7a9

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

.vsts-ci.acr.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ steps:
1919

2020
- task: PublishTestResults@2
2121
inputs:
22-
testRunner: JUnit
2322
testResultsFiles: '**/TEST-RESULTS.xml'
23+
testRunTitle: 'Test results for JavaScript'
24+
25+
- task: PublishCodeCoverageResults@1
26+
inputs:
27+
codeCoverageTool: Cobertura
28+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
29+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'

.vsts-ci.docker.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,12 @@ steps:
1919

2020
- task: PublishTestResults@2
2121
inputs:
22-
testRunner: JUnit
2322
testResultsFiles: '**/TEST-RESULTS.xml'
23+
testRunTitle: 'Test results for JavaScript'
24+
25+
- task: PublishCodeCoverageResults@1
26+
inputs:
27+
codeCoverageTool: Cobertura
28+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
29+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
30+

.vsts-ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ steps:
1010
1111
- task: PublishTestResults@2
1212
inputs:
13-
testRunner: JUnit
1413
testResultsFiles: '**/TEST-RESULTS.xml'
14+
testRunTitle: 'Test results for JavaScript'
1515

16+
- task: PublishCodeCoverageResults@1
17+
inputs:
18+
codeCoverageTool: Cobertura
19+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
20+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
21+
1622
- task: ArchiveFiles@2
1723
inputs:
1824
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'

gulpfile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var gulp = require('gulp');
22
var mocha = require('gulp-mocha');
3+
var istanbul = require('gulp-istanbul')
34
var fs = require('fs');
45

56
gulp.task('default', function () {
@@ -9,5 +10,11 @@ gulp.task('default', function () {
910
reporterOptions{
1011
         mochaFile'./TEST-RESULTS.xml'
1112
}
13+
}))
14+
.pipe(istanbul())
15+
.pipe(istanbul.hookRequire())
16+
.pipe(istanbul.writeReports({
17+
dir: './coverage',
18+
reporters: ['cobertura', 'html']
1219
}));
1320
});

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
"devDependencies": {
1616
"gulp": "^3.9.0",
1717
"gulp-mocha": "^2.2.0",
18-
"mocha-junit-reporter": "^1.12.0"
18+
"mocha-junit-reporter": "^1.12.0",
19+
"gulp-istanbul": "^1.1.3",
20+
"nyc": "^12.0.2"
1921
},
2022
"scripts": {
21-
"test": "./node_modules/.bin/mocha tests/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=./TEST-RESULTS.xml"
23+
"test": "nyc --reporter=cobertura --reporter=html ./node_modules/.bin/mocha tests/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=./TEST-RESULTS.xml"
2224
}
2325
}

0 commit comments

Comments
 (0)