Skip to content

Commit 8f9178f

Browse files
committed
fix: fix the workflow warnings split on Windows (always split by "\n" as the string literals are always generating "/n" terminating lines based on the below-mentioned ES specification)
More details here: http://exploringjs.com/es6/ch_template-literals.html#_line-terminators-in-template-literals-are-always-lf-n 8.2.3 Line terminators in template literals are always LF (\n) # Common ways of terminating lines are: Line feed (LF, \n, U+000A): used by Unix (incl. current macOS) Carriage return (CR, \r, U+000D): used by the old Mac OS. CRLF (\r\n): used by Windows. `All of these line terminators are normalized to LF in template literals.` That is, the following code logs true on all platforms: const str = `BEFORE AFTER`; console.log(str === 'BEFORE\nAFTER'); // true
1 parent 8b83f91 commit 8f9178f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/common/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ export function getMessageWithBorders(message: string, spanLength = 3): string {
389389
return "";
390390
}
391391

392-
const longestRowLength = message.split(EOL).sort((a, b) => { return b.length - a.length; })[0].length;
392+
const longestRowLength = message.split("\n").sort((a, b) => { return b.length - a.length; })[0].length;
393393
let border = "*".repeat(longestRowLength + 2 * spanLength); // * 2 for both sides
394394
if (border.length % 2 === 0) {
395395
border += "*"; // the * should always be an odd number in order to get * in each edge (we will remove the even *s below)
@@ -405,7 +405,7 @@ export function getMessageWithBorders(message: string, spanLength = 3): string {
405405
EOL,
406406
border + EOL,
407407
emptyRow,
408-
...message.split(EOL).map(row => formatRow(row)),
408+
...message.split("\n").map(row => formatRow(row.trim())),
409409
emptyRow,
410410
border + EOL,
411411
EOL

0 commit comments

Comments
 (0)