TEST_RESULTS_MISSING cicd test_error ai_generated true

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

Also available as: JSON · Markdown · 中文
87%Fix Rate
89%Confidence
1Evidence
2023-11-02First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
CircleCI CLI 0.1.28000 active
CircleCI Server v4.1 active
Jest 29.7.0 active
pytest 7.4.0 active

Root Cause

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

中文

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

Official Documentation

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

Workarounds

  1. 90% success Configure the test framework to output JUnit XML: For Jest, add `jest --ci --reporters=default --reporters=jest-junit` and set `JEST_JUNIT_OUTPUT_DIR=test-results/jest`. For pytest, use `pytest --junitxml=test-results/pytest/results.xml`.
    Configure the test framework to output JUnit XML: For Jest, add `jest --ci --reporters=default --reporters=jest-junit` and set `JEST_JUNIT_OUTPUT_DIR=test-results/jest`. For pytest, use `pytest --junitxml=test-results/pytest/results.xml`.
  2. 85% success Update the CircleCI config to match the actual output path: `- store_test_results: path: test-results/jest` if that's where the XML files are generated.
    Update the CircleCI config to match the actual output path: `- store_test_results: path: test-results/jest` if that's where the XML files are generated.
  3. 75% success Run a debug step to list files: `- run: find . -name "*.xml" -type f` to verify test results exist before store_test_results.
    Run a debug step to list files: `- run: find . -name "*.xml" -type f` to verify test results exist before store_test_results.

中文步骤

  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 之前验证测试结果是否存在。

Dead Ends

Common approaches that don't work:

  1. 80% fail

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

  2. 70% fail

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

  3. 60% fail

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