SonarQube的JavaScript插件中是否有一个错误,它不会获取子目录中测试的Surefire测试结果?



我有一个带有2个文件的Surefire结果目录:TEST-Chrome_4202311135_Windows.dashboard.MonkeyTest.xmlTEST-Chrome_4202311135_Windows.PersonTest.xml。因此,我的测试具有以下目录结构:

-tests
    -PersonTest.js
    -dashboard
        -MonkeyTest.js

当我运行声纳跑步者时,它会拾取PersonTest.js,但说dashboard/MonkeyTest.js不存在:

18:24:58.747 WARN  - Test result will not be saved for test class "dashboard.MonkeyTest", because SonarQube associated resource has not been found using file name: "dashboard/MonkeyTest.js"

有人遇到过吗?在我看来,因为文件存在。

好吧,我已经深入研究了Sonarqube的JavaScript插件代码进行调试。找到了错误。看来此错误仅发生在Windows上。代码的作用是在所有测试文件上进行迭代,在我的情况下," PersonTest.js"one_answers" dashboard/monkeytest.js",并查找文件" dashboard monkeytest.js"。但是,因为"仪表板/monkeytest.js"不等于"仪表板 monkeytest.js",所以它忽略了该测试的结果。老实说,对于每个测试结果的所有测试文件都迭代效率低下。以下是Java方法。我会尝试与作者联系。

protected InputFile getTestFileRelativePathToBaseDir(String fileName) {
    for (InputFile inputFile : fileSystem.inputFiles(testFilePredicate)) {
      LOG.warn("Slava: '" + inputFile.file().getAbsolutePath() + "'");
      if (inputFile.file().getAbsolutePath().endsWith(fileName)) {
        LOG.debug("Found potential test file corresponding to file name: {}", fileName);
        LOG.debug("Will fetch SonarQube associated resource with (logical) relative path to project base directory: {}", inputFile.relativePath());
        return inputFile;
      }
    }
    return null;
}

最新更新