【发布时间】:2021-04-27 18:34:39
【问题描述】:
我正在尝试使用 Cypress 测试在 Azure DevOps 上设置管道。
本地测试输出文件已正确创建。
我正在使用 npx cypress 运行命令
我收到发布测试结果的错误/警告:
##[警告]没有找到匹配**/test-output-*.xml的测试结果文件。
这是我的 cypress.json 文件:
{
"reporter": "junit",
"reporterOptions": {
"mochaFile": "tests/test-output-[hash].xml",
"toConsole": true,
"attachments": true
},
"video": false,
"pluginsFile": "cypress/plugins/index.js",
"supportFile": "cypress/support/index.js"
}
这里是 azure-pipelines.yml:
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- develop
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
displayName: 'npm install'
- script:
npx cypress run
displayName: 'Execute cypress tests'
- task: PublishTestResults@2
displayName: "Publish Test Results"
condition: always()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-output-*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)'
- task: PublishBuildArtifacts@1
condition: always()
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
我试图做所有奇怪的事情,但没有任何帮助。 检查了所有 StackOverflow 主题,如下所示:
Azure DevOps test -xml not found after running the Cypress tests
Is there any way to show Cypress Test Results in Azure DevOps Test Results Tab?
Azure DevOps test -xml not found after running the Cypress tests
No test result files were found using search pattern '...\**\TEST-*.xml
Cypress Integration with DevOps
所有都希望根据赛普拉斯文档和博客等正确设置。
可能没有在 Azure 上创建测试输出文件?
也许有人有线索?
编辑:
我使用ls -al 命令检查,没有创建tests 文件夹。
但即使我在启动 cypress 之前使用 mkdir tests 创建它,在 cypress 作业之后该文件夹也是空的。
所以赛普拉斯没有创建测试输出报告。为什么在本地创建文件但在 Azure 上没有?
【问题讨论】:
标签: junit azure-devops mocha.js cypress