use*_*861 1 junit lint jenkins angular-cli jenkins-declarative-pipeline
如何在 Jenkins 中显示“npm lint”结果?我知道如何在 Jenkins 中显示“pytest”结果:
pytest --junitxml=./path/to/pytestFile.xml ./path/to/codejunit testResults: "./path/to/pytestFile.xml"一旦我这样做了,我的测试结果就会出现在 Jenkins 的“测试结果”窗口中。我想对我的 angular lint 结果做类似的事情。我尝试这样做,但没有用:
npm lint --junitxml=./path/to/lintFile.xmljunit testResults: "./path/to/lintFile.xml"问题是 npm 没有 --junitxml 开关。我怎样才能做到这一点?我正在使用 Jenkins 声明式管道。
JUnit 是测试结果的格式,而不是 lint 结果。尝试使用它是没有意义的。
最好使用的插件是Warnings Next Generation。它tslint列为受支持的格式。
steps {
sh 'npm run-script --silent -- ng lint --format=checkstyle >checkstyle-result.xml'
}
post {
always {
recordIssues tool: tsLint(pattern: 'checkstyle-result.xml'),
enableForFailure: true
}
}
Run Code Online (Sandbox Code Playgroud)
如果您的工作区中有多个项目,您可能会受到#14659 的影响。指定单个项目或通过管道传输输出split -l 1。
如您所见,您将获得一份专门针对 TSLint 的报告,与其他分析问题和测试结果分开。它还理解不同的严重性级别,这是无法用 JUnit 表达的。
| 归档时间: |
|
| 查看次数: |
2667 次 |
| 最近记录: |