我已创建以下YAML文件,使用PublishTestResults任务在Azure DevOps门户中显示mocha测试结果。
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.14.1'
displayName: 'Install Node.js'
- script: |
npm install
mocha test --reporter mocha-junit-reporter
npm test
displayName: 'npm install and test'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: '**/TEST-RESULTS.xml'
- task: ArchiveFiles@2
displayName: 'Archive $(System.DefaultWorkingDirectory)'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/node.zip'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
但是每当我运行构建时,都会收到以下警告。
"No test result files matching **/TEST-RESULTS.xml were found."
主要目的是在仪表板或测试选项卡中单独显示摩卡测试结果,以便我们无需检查构建过程中的测试任务即可查看测试结果。
TEST-RESULTS.xml
的测试结果文件吗? - undefined