mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
Fix EOL issues - remove all \r from annotation message
This commit is contained in:
parent
4197e7a327
commit
760c090915
7 changed files with 20 additions and 13 deletions
|
|
@ -23,9 +23,7 @@ Object {
|
||||||
"annotation_level": "failure",
|
"annotation_level": "failure",
|
||||||
"end_line": 27,
|
"end_line": 27,
|
||||||
"message": "Assert.Equal() Failure
|
"message": "Assert.Equal() Failure
|
||||||
|
|
||||||
Expected: 3
|
Expected: 3
|
||||||
|
|
||||||
Actual: 2",
|
Actual: 2",
|
||||||
"path": "DotnetTests.XUnitTests/CalculatorTests.cs",
|
"path": "DotnetTests.XUnitTests/CalculatorTests.cs",
|
||||||
"start_line": 27,
|
"start_line": 27,
|
||||||
|
|
|
||||||
13
dist/index.js
generated
vendored
13
dist/index.js
generated
vendored
|
|
@ -254,7 +254,7 @@ function getAnnotation(test, testSuite, workDir, trackedFiles) {
|
||||||
start_line: src.line,
|
start_line: src.line,
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: `${(_e = test.error) === null || _e === void 0 ? void 0 : _e.error}\n\n${(_f = test.error) === null || _f === void 0 ? void 0 : _f.stackTrace}`,
|
message: `${markdown_utils_1.fixEol((_e = test.error) === null || _e === void 0 ? void 0 : _e.error)}\n\n${markdown_utils_1.fixEol((_f = test.error) === null || _f === void 0 ? void 0 : _f.stackTrace)}`,
|
||||||
title: `[${testSuite.suite.path}] ${test.testStart.test.name}`
|
title: `[${testSuite.suite.path}] ${test.testStart.test.name}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -440,7 +440,7 @@ function getAnnotations(testClasses, workDir, trackedFiles) {
|
||||||
start_line: src.line,
|
start_line: src.line,
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: t.error.Message[0],
|
message: markdown_utils_1.fixEol(t.error.Message[0]),
|
||||||
title: `[${tc.name}] ${t.name}`
|
title: `[${tc.name}] ${t.name}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -559,7 +559,7 @@ function getAnnotations(junit, workDir, trackedFiles) {
|
||||||
start_line: src.line,
|
start_line: src.line,
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: ex,
|
message: markdown_utils_1.fixEol(ex),
|
||||||
title: `[${suite.$.name}] ${tc.$.name.trim()}`
|
title: `[${suite.$.name}] ${tc.$.name.trim()}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -931,7 +931,7 @@ exports.getCheckRunSha = getCheckRunSha;
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.tableEscape = exports.table = exports.link = exports.details = exports.Icon = exports.Align = void 0;
|
exports.fixEol = exports.tableEscape = exports.table = exports.link = exports.details = exports.Icon = exports.Align = void 0;
|
||||||
var Align;
|
var Align;
|
||||||
(function (Align) {
|
(function (Align) {
|
||||||
Align["Left"] = ":---";
|
Align["Left"] = ":---";
|
||||||
|
|
@ -963,6 +963,11 @@ function tableEscape(content) {
|
||||||
return content.toString().replace('|', '\\|');
|
return content.toString().replace('|', '\\|');
|
||||||
}
|
}
|
||||||
exports.tableEscape = tableEscape;
|
exports.tableEscape = tableEscape;
|
||||||
|
function fixEol(text) {
|
||||||
|
var _a;
|
||||||
|
return (_a = text === null || text === void 0 ? void 0 : text.replace(/\r/g, '')) !== null && _a !== void 0 ? _a : '';
|
||||||
|
}
|
||||||
|
exports.fixEol = fixEol;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
|
||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -2,7 +2,7 @@ import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||||
|
|
||||||
import getReport from '../../report/get-report'
|
import getReport from '../../report/get-report'
|
||||||
import {normalizeFilePath} from '../../utils/file-utils'
|
import {normalizeFilePath} from '../../utils/file-utils'
|
||||||
import {Icon} from '../../utils/markdown-utils'
|
import {Icon, fixEol} from '../../utils/markdown-utils'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ReportEvent,
|
ReportEvent,
|
||||||
|
|
@ -176,7 +176,7 @@ function getAnnotation(
|
||||||
start_line: src.line,
|
start_line: src.line,
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: `${test.error?.error}\n\n${test.error?.stackTrace}`,
|
message: `${fixEol(test.error?.error)}\n\n${fixEol(test.error?.stackTrace)}`,
|
||||||
title: `[${testSuite.suite.path}] ${test.testStart.test.name}`
|
title: `[${testSuite.suite.path}] ${test.testStart.test.name}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {parseStringPromise} from 'xml2js'
|
||||||
|
|
||||||
import {normalizeFilePath} from '../../utils/file-utils'
|
import {normalizeFilePath} from '../../utils/file-utils'
|
||||||
import {parseAttribute} from '../../utils/xml-utils'
|
import {parseAttribute} from '../../utils/xml-utils'
|
||||||
import {Icon} from '../../utils/markdown-utils'
|
import {Icon, fixEol} from '../../utils/markdown-utils'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TestExecutionResult,
|
TestExecutionResult,
|
||||||
|
|
@ -123,7 +123,7 @@ function getAnnotations(testClasses: TestClass[], workDir: string, trackedFiles:
|
||||||
start_line: src.line,
|
start_line: src.line,
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: t.error.Message[0],
|
message: fixEol(t.error.Message[0]),
|
||||||
title: `[${tc.name}] ${t.name}`
|
title: `[${tc.name}] ${t.name}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||||
import {parseStringPromise} from 'xml2js'
|
import {parseStringPromise} from 'xml2js'
|
||||||
|
|
||||||
import {JunitReport, TestCase, TestSuite} from './jest-junit-types'
|
import {JunitReport, TestCase, TestSuite} from './jest-junit-types'
|
||||||
import {Icon} from '../../utils/markdown-utils'
|
import {fixEol, Icon} from '../../utils/markdown-utils'
|
||||||
import {normalizeFilePath} from '../../utils/file-utils'
|
import {normalizeFilePath} from '../../utils/file-utils'
|
||||||
import {parseAttribute} from '../../utils/xml-utils'
|
import {parseAttribute} from '../../utils/xml-utils'
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ function getAnnotations(junit: JunitReport, workDir: string, trackedFiles: strin
|
||||||
start_line: src.line,
|
start_line: src.line,
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: ex,
|
message: fixEol(ex),
|
||||||
title: `[${suite.$.name}] ${tc.$.name.trim()}`
|
title: `[${suite.$.name}] ${tc.$.name.trim()}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,3 +30,7 @@ export function table(headers: ToString[], align: ToString[], ...rows: ToString[
|
||||||
export function tableEscape(content: ToString): string {
|
export function tableEscape(content: ToString): string {
|
||||||
return content.toString().replace('|', '\\|')
|
return content.toString().replace('|', '\\|')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fixEol(text?: string): string {
|
||||||
|
return text?.replace(/\r/g, '') ?? ''
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue