Fixed undefined error in stack trace logic
parent
46ddff2c3b
commit
bb51f4aca4
|
@ -958,6 +958,10 @@ const ResultsParser = {
|
|||
return testMeta;
|
||||
}
|
||||
const trace = failure['stack-trace']._cdata;
|
||||
if (trace === undefined) {
|
||||
core.warning(`No cdata in stack trace for test case: ${fullname}`);
|
||||
return testMeta;
|
||||
}
|
||||
const point = ResultsParser.findAnnotationPoint(trace);
|
||||
if (!point.path || !point.line) {
|
||||
core.warning(`Not able to find annotation point for failed test! Test trace: ${trace}`);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -114,6 +114,24 @@ describe('ResultsParser', () => {
|
|||
expect(result.annotation).toBeUndefined();
|
||||
});
|
||||
|
||||
test('no cdata in stack trace', () => {
|
||||
const result = ResultsParser.convertTestCase('Test Suite', {
|
||||
_attributes: {
|
||||
name: 'Test Name',
|
||||
duration: '3.14',
|
||||
},
|
||||
failure: {
|
||||
message: { _cdata: 'Message CDATA' },
|
||||
'stack-trace': {},
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.suite).toBe('Test Suite');
|
||||
expect(result.title).toBe('Test Name');
|
||||
expect(result.duration).toBe(3.14);
|
||||
expect(result.annotation).toBeUndefined();
|
||||
});
|
||||
|
||||
test('no annotation path', () => {
|
||||
const result = ResultsParser.convertTestCase('Test Suite', {
|
||||
_attributes: {
|
||||
|
|
|
@ -90,6 +90,10 @@ const ResultsParser = {
|
|||
}
|
||||
|
||||
const trace = failure['stack-trace']._cdata;
|
||||
if (trace === undefined) {
|
||||
core.warning(`No cdata in stack trace for test case: ${fullname}`);
|
||||
return testMeta;
|
||||
}
|
||||
const point = ResultsParser.findAnnotationPoint(trace);
|
||||
if (!point.path || !point.line) {
|
||||
core.warning(`Not able to find annotation point for failed test! Test trace: ${trace}`);
|
||||
|
|
Loading…
Reference in New Issue