Skip to content

Commit a766e40

Browse files
committed
Added Test Coverage
1 parent c57180c commit a766e40

File tree

3 files changed

+104
-20
lines changed

3 files changed

+104
-20
lines changed

azure-pipelines.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,38 @@ pool:
1212
steps:
1313
- task: NodeTool@0
1414
inputs:
15-
versionSpec: '10.x'
16-
displayName: 'Install Node.js'
15+
versionSpec: '12.x'
16+
displayName: 'Install Node.js 12'
1717

1818
- script: |
19-
npm install
20-
npm run build
21-
npm run test
22-
displayName: 'npm install, build and test'
19+
npm install --progress=false --loglevel=error --no-fund
20+
npm run coverage
21+
displayName: 'npm install and test'
22+
23+
- task: PublishTestResults@2
24+
condition: succeededOrFailed()
25+
inputs:
26+
testRunner: JUnit
27+
testResultsFiles: 'Coverage/test-results.xml'
28+
29+
- task: PublishCodeCoverageResults@1
30+
inputs:
31+
codeCoverageTool: Cobertura
32+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
33+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
34+
35+
- script: |
36+
npm pack
37+
displayName: 'Create package'
2338
2439
- task: CopyFiles@2
2540
inputs:
26-
SourceFolder: '$(Build.SourcesDirectory)'
27-
Contents: |
28-
dist/**
29-
LICENSE
30-
package.json
31-
README.md
32-
.gitignore
33-
.npmignore
34-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
41+
contents: '*.tgz'
42+
targetFolder: $(Build.ArtifactStagingDirectory)
43+
displayName: 'Copy package to artifacts staging directory'
3544

3645
- task: PublishBuildArtifacts@1
3746
inputs:
38-
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
39-
ArtifactName: 'drop'
40-
publishLocation: 'Container'
47+
path: $(Build.ArtifactStagingDirectory)
48+
artifact: package
49+
displayName: 'Publish artifacts'

package-lock.json

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "tsc",
99
"test": "node node_modules/mocha/bin/mocha -r ts-node/register tests/**/*.test.ts",
10-
"coverage": "nyc npm run test",
10+
"coverage": "nyc npm run test -- --reporter=mocha-junit-reporter --reporter-options mochaFile=coverage/test-results.xml",
1111
"package": "npm run build & npm pack"
1212
},
1313
"publishConfig": {
@@ -37,16 +37,24 @@
3737
"@types/sinon": "^9.0.4",
3838
"chai": "^4.2.0",
3939
"mocha": "^7.1.2",
40+
"mocha-junit-reporter": "^1.23.3",
4041
"nyc": "^15.0.1",
4142
"ts-node": "^8.10.1",
4243
"typescript": "^3.9.3"
4344
},
4445
"nyc": {
4546
"reporter": [
47+
"cobertura",
4648
"text"
4749
],
4850
"temp-directory": "./coverage/.nyc_output",
49-
"exclude": "typings",
51+
"exclude": [
52+
"typings",
53+
"tests"
54+
],
55+
"include": [
56+
"src/**/*.ts"
57+
],
5058
"extension": [
5159
".ts"
5260
],

0 commit comments

Comments
 (0)