| 39 | } |
| 40 | |
| 41 | function normalizeCodeLocInfo(str) { |
| 42 | if (typeof str !== 'string') { |
| 43 | return str; |
| 44 | } |
| 45 | // This special case exists only for the special source location in |
| 46 | // ReactElementValidator. That will go away if we remove source locations. |
| 47 | str = str.replace(/Check your code at .+?:\d+/g, 'Check your code at **'); |
| 48 | // V8 format: |
| 49 | // at Component (/path/filename.js:123:45) |
| 50 | // React format: |
| 51 | // in Component (at filename.js:123) |
| 52 | return str.replace(/\n +(?:at|in) ([\S]+)[^\n]*/g, function (m, name) { |
| 53 | return '\n in ' + name + ' (at **)'; |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | const createMatcherFor = (consoleMethod, matcherName) => |
| 58 | function matcher(callback, expectedMessages, options = {}) { |