-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit-test.template.yml
39 lines (34 loc) · 1.01 KB
/
unit-test.template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
parameters:
- name: YARN_CACHE_FOLDER
type: string
default: $(Build.SourcesDirectory)/node_modules
steps:
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: ${{ parameters.YARN_CACHE_FOLDER }}
cacheHitVar: CACHE_RESTORED
displayName: Cache Yarn packages
- script: |
yarn install
condition: ne(variables.CACHE_RESTORED, 'true')
displayName: Installing Modules
- script: |
yarn test
name: UnitTest
displayName: Jest Unit Testing
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '**/reports/junit.xml'
mergeTestResults: true
failTaskOnFailedTests: true
testRunTitle: 'Unit Tests'
- task: PublishCodeCoverageResults@1
displayName: 'Publish Code Coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/reports/coverage/cobertura-coverage.xml'