这是 SonarQube 的 JavaScript 插件中的错误,它没有获取子目录中测试的 Surefire 测试结果吗?

Is it a bug in SonarQube's JavaScript plugin that it doesn't pick up Surefire test results of tests that are in a subdirectory?

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

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

当我 运行 Sonar Runner 时,它接收到 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" 和 "dashboard/MonkeyTest.js",并查找文件 "dashboard\MonkeyTest.js"。但是因为 "dashboard/MonkeyTest.js" 不等于 "dashboard\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;
}