TEST_RESULTS_MISSING cicd test_error ai_generated true

在配置的路径中未找到测试结果。请确保您的测试将 JUnit XML 报告输出到指定目录。

No test results found in the configured paths. Ensure your tests output JUnit XML reports to the specified directory.

ID: cicd/circleci-no-test-results

其他格式: JSON · Markdown 中文 · English
87%修复率
89%置信度
1证据数
2023-11-02首次发现

版本兼容性

版本状态引入弃用备注
CircleCI CLI 0.1.28000 active
CircleCI Server v4.1 active
Jest 29.7.0 active
pytest 7.4.0 active

根因分析

CircleCI 的测试报告步骤找不到 JUnit XML 文件,因为测试框架未配置生成它们、输出路径不正确或测试尚未运行。

English

CircleCI's test reporting step cannot find JUnit XML files because the test framework is not configured to generate them, the output path is incorrect, or the tests haven't run yet.

generic

官方文档

https://circleci.com/docs/collect-test-data/

解决方案

  1. 配置测试框架以输出 JUnit XML:对于 Jest,添加 `jest --ci --reporters=default --reporters=jest-junit` 并设置 `JEST_JUNIT_OUTPUT_DIR=test-results/jest`。对于 pytest,使用 `pytest --junitxml=test-results/pytest/results.xml`。
  2. 更新 CircleCI 配置以匹配实际输出路径:如果 XML 文件生成在 `test-results/jest` 中,则使用 `- store_test_results: path: test-results/jest`。
  3. 运行调试步骤列出文件:`- run: find . -name "*.xml" -type f` 以在 store_test_results 之前验证测试结果是否存在。

无效尝试

常见但无效的做法:

  1. 80% 失败

    Changing the store_test_results path to a random directory without generating XML files; the step still finds nothing.

  2. 70% 失败

    Disabling the store_test_results step entirely; this removes test reporting but the underlying issue (no XML generation) remains for other steps.

  3. 60% 失败

    Assuming the test framework generates XML by default; many frameworks (e.g., pytest, Jest) require explicit configuration.