Skip to content

Commit c980f97

Browse files
committed
Fix crash with snapshot testing
Seems like `String#repeat` does not like negative numbers.
1 parent 34bebc4 commit c980f97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/code-excerpt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const truncate = require('cli-truncate');
66
const chalk = require('chalk');
77

88
const formatLineNumber = (lineNumber, maxLineNumber) =>
9-
' '.repeat(String(maxLineNumber).length - String(lineNumber).length) + lineNumber;
9+
' '.repeat(Math.max(0, String(maxLineNumber).length - String(lineNumber).length)) + lineNumber;
1010

1111
module.exports = (file, line, options) => {
1212
options = options || {};

0 commit comments

Comments
 (0)