-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Version
@jest/reporters 29.7.0
Steps to reproduce
create a file listType.ts that contains:
export class FooType extends ListElementType {
//...
static wrapContent(content: any) {
//...
}
export class BarType extends ListElementType {
//...
static wrapContent(content: any) {
//...
}jest.config.ts:
collectCoverage: true,
coverageReporters: ['text', 'text-summary', 'cobertura'],
reporters: [
'default',
['jest-junit', {
outputDirectory: 'results/test',
outputName: 'report.xml'
}]
],Expected behavior
Jenkins plugin accepts the coverage report (as it does when we run the tests using Karma).
cobertura-coverage.xml lists said classes as classes with nested methods, so method names don't clash.
Actual behavior
org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 5cdc94ce-ba8d-405d-9714-3e704ae542af
java.lang.IllegalArgumentException: There is already the same child [METHOD] wrapContent()V <0> with the name wrapContent()V in [CLASS] listType.ts <28, LINE: 3.57% (1/28)>
at PluginClassLoader for coverage//edu.hm.hafner.coverage.Node.addChild(Node.java:178)
cobertura-coverage.xml report contains:
<class name="listType.ts" filename="src\app\listType.ts" [..snip...]>
<methods>
[..snip...]
<method name="FooType" hits="0" signature="()V">
<lines>
<line number="238" hits="0"/>
</lines>
</method>
<method name="wrapContent" hits="0" signature="()V">
<lines>
<line number="252" hits="0"/>
</lines>
</method>
<method name="getDefault" hits="0" signature="()V">
<lines>
<line number="262" hits="0"/>
</lines>
</method>
<method name="BarType" hits="0" signature="()V">
<lines>
<line number="277" hits="0"/>
</lines>
</method>
<method name="wrapContent" hits="0" signature="()V">
<lines>
<line number="288" hits="0"/>
</lines>
</method>i.e.: the exported class is identified as method, the methods of this class are not nested as they should be.
Additional context
No response
Environment
Coverage
Version2.7.1
https://plugins.jenkins.io/coverage/
"node_modules/@jest/core": {
"version": "29.7.0",
"dependencies": {
"@jest/console": "^29.7.0",
"@jest/reporters": "^29.7.0",
"@jest/test-result": "^29.7.0",
"@jest/transform": "^29.7.0",
"@jest/types": "^29.6.3",
"jest-changed-files": "^29.7.0",
"jest-config": "^29.7.0",
"jest-haste-map": "^29.7.0",
"jest-message-util": "^29.7.0",
"jest-regex-util": "^29.6.3",
"jest-resolve": "^29.7.0",
"jest-resolve-dependencies": "^29.7.0",
"jest-runner": "^29.7.0",
"jest-runtime": "^29.7.0",
"jest-snapshot": "^29.7.0",
"jest-util": "^29.7.0",
"jest-validate": "^29.7.0",
"jest-watcher": "^29.7.0",
...
"node_modules/@jest/reporters": {
"version": "29.7.0",
"dependencies": {
"dependencies": {
"@bcoe/v8-coverage": "^0.2.3",
"@jest/console": "^29.7.0",
"@jest/test-result": "^29.7.0",
"@jest/transform": "^29.7.0",
"@jest/types": "^29.6.3",
"@jridgewell/trace-mapping": "^0.3.18",
"@types/node": "*",
"chalk": "^4.0.0",
"collect-v8-coverage": "^1.0.0",
"exit": "^0.1.2",
"glob": "^7.1.3",
"graceful-fs": "^4.2.9",
"istanbul-lib-coverage": "^3.0.0",
"istanbul-lib-instrument": "^6.0.0",
"istanbul-lib-report": "^3.0.0",
"istanbul-lib-source-maps": "^4.0.0",
"istanbul-reports": "^3.1.3",
"jest-message-util": "^29.7.0",
"jest-util": "^29.7.0",
"jest-worker": "^29.7.0",
"slash": "^3.0.0",
"string-length": "^4.0.1",
"strip-ansi": "^6.0.0",
"v8-to-istanbul": "^9.0.1"