Skip to content

Commit

Permalink
Use regexp instead of split-map-join (#7206)
Browse files Browse the repository at this point in the history
* Use regexp instead of split-map-join

* Rename constant
  • Loading branch information
Connormiha authored and SimenB committed Oct 18, 2018
1 parent 7d5de68 commit 7ef22a9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/jest-message-util/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ const STACK_TRACE_COLOR = chalk.dim;
const STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
const EXEC_ERROR_MESSAGE = 'Test suite failed to run';
const ERROR_TEXT = 'Error: ';
const NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm;

const indentAllLines = (lines: string, indent: string) =>
lines
.split('\n')
.map(line => (line ? indent + line : line))
.join('\n');
lines.replace(NOT_EMPTY_LINE_REGEXP, indent);

const trim = string => (string || '').trim();

Expand Down

0 comments on commit 7ef22a9

Please sign in to comment.