【问题标题】:AzureDevops: How to publish test results when tests fail?Azure Devops:测试失败时如何发布测试结果?
【发布时间】:2019-12-09 20:25:54
【问题描述】:

我有一些用jest 编写的单元测试。显然,有时他们会失败。我想将结果发布到构建Test 部分。 问题是如果先前的任务失败,任务PublishTestResults@2 永远不会运行,因此构建的测试部分中没有数据。 在这种情况下,我得到的是消息##[error]Bash exited with code '1'.

这是我的azure-pipelines.yml

- script: npm run test:publish
    displayName: "Run Unit Tests"
- script: npm run build
    displayName: "Build"
- task: PublishTestResults@2
    displayName: "Publish unit test result"
    inputs:
      testResultsFiles: "unit_test_report.xml"
      testRunTitle: "Unit tests with Jest"
      mergeTestResults: false
      searchFolder: "$(Build.SourcesDirectory)"
      condition: always()
      failTaskOnFailedTests: false

我错过了什么?

【问题讨论】:

    标签: node.js azure-devops jestjs


    【解决方案1】:

    您在 YAML 中将 condition: always() 缩进了一个位置,它应该与 displayName 处于同一级别

    【讨论】:

    • 对不起,我错过了,但看起来你的 condition 行在你的 yaml 中缩进了太多,不应该直接在 displayName 下吗?
    猜你喜欢
    • 2021-05-07
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 1970-01-01
    • 1970-01-01
    • 2020-05-28
    • 2019-11-09
    • 2020-03-11
    相关资源
    最近更新 更多