TrimStackTracePath.js 745 B

12345678910111213
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function TrimStackTracePath(line) {
  6. if (line) {
  7. line = line.replace(/ \(.+([\\\/]test[\\\/]|[\\\/]unittest[\\\/]).[^\\\/]*./ig, " (");
  8. // normalize output by replacing leading whitespace (\s+) of each stack line (starting with 'at ') with 3 spaces (to preserve current baselines)
  9. line = line.replace(/^\s+at /gm, ' at ');
  10. }
  11. return line;
  12. }