mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
Merge pull request #399 from AnthonyBarbier/fix_junit_message
This commit is contained in:
commit
3c93b151a3
6 changed files with 25 additions and 8 deletions
|
|
@ -10,4 +10,5 @@ AcmeLibTests.AcmeLibTests
|
||||||
✅ test_always_pass
|
✅ test_always_pass
|
||||||
✅ test_always_skip
|
✅ test_always_skip
|
||||||
❌ test_always_fail
|
❌ test_always_fail
|
||||||
|
failed
|
||||||
```
|
```
|
||||||
|
|
@ -41,7 +41,7 @@ at java.lang.Thread.run(Thread.java:748)
|
||||||
|
|
||||||
",
|
",
|
||||||
"line": 29,
|
"line": 29,
|
||||||
"message": undefined,
|
"message": "java.lang.AssertionError: expected [1.2.1] but found [1.2.0]",
|
||||||
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
||||||
},
|
},
|
||||||
"name": "testVersionStrings",
|
"name": "testVersionStrings",
|
||||||
|
|
@ -100,7 +100,7 @@ at java.lang.Thread.run(Thread.java:748)
|
||||||
|
|
||||||
",
|
",
|
||||||
"line": 29,
|
"line": 29,
|
||||||
"message": undefined,
|
"message": "java.lang.AssertionError: expected [1.2.1] but found [1.2.0]",
|
||||||
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
||||||
},
|
},
|
||||||
"name": "testVersionStrings",
|
"name": "testVersionStrings",
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ TestRunResult {
|
||||||
"error": {
|
"error": {
|
||||||
"details": undefined,
|
"details": undefined,
|
||||||
"line": undefined,
|
"line": undefined,
|
||||||
"message": undefined,
|
"message": "failed",
|
||||||
"path": undefined,
|
"path": undefined,
|
||||||
},
|
},
|
||||||
"name": "test_always_fail",
|
"name": "test_always_fail",
|
||||||
|
|
|
||||||
11
dist/index.js
generated
vendored
11
dist/index.js
generated
vendored
|
|
@ -1178,7 +1178,7 @@ class JavaJunitParser {
|
||||||
return 'success';
|
return 'success';
|
||||||
}
|
}
|
||||||
getTestCaseError(tc) {
|
getTestCaseError(tc) {
|
||||||
var _a;
|
var _a, _b;
|
||||||
if (!this.options.parseErrors) {
|
if (!this.options.parseErrors) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
@ -1198,11 +1198,18 @@ class JavaJunitParser {
|
||||||
line = src.line;
|
line = src.line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let message;
|
||||||
|
if (typeof failure === 'object') {
|
||||||
|
message = failure.$.message;
|
||||||
|
if ((_b = failure.$) === null || _b === void 0 ? void 0 : _b.type) {
|
||||||
|
message = failure.$.type + ': ' + message;
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
path: filePath,
|
path: filePath,
|
||||||
line,
|
line,
|
||||||
details,
|
details,
|
||||||
message: typeof failure === 'object' ? failure.message : undefined
|
message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exceptionThrowSource(stackTrace) {
|
exceptionThrowSource(stackTrace) {
|
||||||
|
|
|
||||||
|
|
@ -137,11 +137,18 @@ export class JavaJunitParser implements TestParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let message
|
||||||
|
if (typeof failure === 'object') {
|
||||||
|
message = failure.$.message
|
||||||
|
if (failure.$?.type) {
|
||||||
|
message = failure.$.type + ': ' + message
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
path: filePath,
|
path: filePath,
|
||||||
line,
|
line,
|
||||||
details,
|
details,
|
||||||
message: typeof failure === 'object' ? failure.message : undefined
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ export interface TestCase {
|
||||||
|
|
||||||
export interface Failure {
|
export interface Failure {
|
||||||
_: string
|
_: string
|
||||||
type: string
|
$: {
|
||||||
|
type?: string
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue