Reactjs 如何使用开玩笑的声纳记者?

Reactjs 如何使用开玩笑的声纳记者?,reactjs,jestjs,sonarqube,Reactjs,Jestjs,Sonarqube,如何使用开玩笑的声纳记者?在config.json中,我们使用了“testResultsProcessor”:“/config/jest/resultsProcessor”: resultsProcessor.js module.exports = (results) => { process.env.TEST_REPORT_PATH = root('reports/unit') process.env.JEST_SUITE_NAME = 'React Unit Tests' proces

如何使用开玩笑的声纳记者?在
config.json
中,我们使用了
“testResultsProcessor”:“/config/jest/resultsProcessor”

resultsProcessor.js

module.exports = (results) => {
process.env.TEST_REPORT_PATH = root('reports/unit')
process.env.JEST_SUITE_NAME = 'React Unit Tests'
process.env.JEST_JUNIT_OUTPUT = root('reports/unit/junit.xml')
require(root('node_modules/jest-sonar-reporter/index')).apply(this, [results])
require(root('node_modules/jest-junit/index')).apply(this, [results])
// add any other processor you need
return results
}
当我们使用
“jest”:“^21.2.1”
时,它工作得很好, 但在将Jest更新为“Jest”:“^26.1.0””之后

根据文件

"reporters": [ "default",[
"jest-junit", {
"outputDirectory":"reports/unit",
"suiteName": "ANZ-React-BoilerPlate Unit Tests",
"outputName": "junit.xml"
}]],

jest-junit
工作正常,但是如何支持
jest-sonar-reporter

我使用jest-sonar-npm包解决了这个问题。

“更新jest后”什么,确切地说-似乎您忘记了包含实际问题。上一次发布是在两年前,现在已经存档,所以它可能无法与更新版本的Jest一起使用。我需要的主要帮助是,我只想使用Jest sonar reporter。我使用Jest sonar npm包的最新Jest解决了这个问题。