diff --git a/packages/pretty-format/src/index.js b/packages/pretty-format/src/index.js index 3bf9b6de5750..af3f32be8011 100644 --- a/packages/pretty-format/src/index.js +++ b/packages/pretty-format/src/index.js @@ -106,7 +106,7 @@ function printBasicValue( return printNumber(val); } if (typeOf === 'string') { - return /\n/.test(val) + return /\r\n|\n|\r/g.test(val) ? '`' + val.replace(/\\/g, '\\$&') + '`' : '"' + val.replace(/"|\\/g, '\\$&') + '"'; }