8000 Merge pull request #47 from stacktracejs/spaces-in-filenames · Aleksey28/error-stack-parser@0684a29 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0684a29

Browse files
authored
Merge pull request stacktracejs#47 from stacktracejs/spaces-in-filenames
Parse Node stacktraces correctly for filenames with spaces
2 parents 2d84c60 + f1e8e51 commit 0684a29

9 files changed

+2197
-2588
lines changed

dist/error-stack-parser.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,18 @@
5858
// Throw away eval information until we implement stacktrace.js/stackframe#8
5959
line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, '');
6060
}
61-
var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1);
62-
var locationParts = this.extractLocation(tokens.pop());
61+
var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(');
62+
63+
// capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
64+
// case it has spaces in it, as the string is split on \s+ later on
65+
var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
66+
67+
// remove the parenthesized location from the line, if it was matched
68+
sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
69+
70+
var tokens = sanitizedLine.split(/\s+/).slice(1);
71+
// if a location was matched, pass it to extractLocation() otherwise pop the last token
72+
var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
6373
var functionName = tokens.join(' ') || undefined;
6474
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
6575

dist/error-stack-parser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/error-stack-parser.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

error-stack-parser.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,18 @@
5858
// Throw away eval information until we implement stacktrace.js/stackframe#8
5959
line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, '');
6060
}
61-
var tokens = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1);
62-
var locationParts = this.extractLocation(tokens.pop());
61+
var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(');
62+
63+
// capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
64+
// case it has spaces in it, as the string is split on \s+ later on
65+
var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
66+
67+
// remove the parenthesized location from the line, if it was matched
68+
sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
69+
70+
var tokens = sanitizedLine.split(/\s+/).slice(1);
71+
// if a location was matched, pass it to extractLocation() otherwise pop the last token
72+
var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
6373
var functionName = tokens.join(' ') || undefined;
6474
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
6575

karma.conf.ci.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,15 @@ module.exports = function(config) {
66

77
// Check out https://saucelabs.com/platforms for all browser/platform combos
88
var customLaunchers = {
9-
slIOS9: {
9+
slIOSLatest: {
1010
base: 'SauceLabs',
11-
browserName: 'iPhone',
12-
platform: 'OS X 10.12',
13-
version: '9.3'
11+
browserName: 'iphone',
12+
version: 'latest'
1413
},
15-
// *Sigh* Cannot get this working with appium or selenium...
16-
// slIOS10: {
17-
// base: 'SauceLabs',
18-
// browserName: 'iPhone',
19-
// platform: 'macOS 10.12',
20-
// version: '10.2'
21-
// },
22-
slAndroid4: {
14+
slIOS10: {
2315
base: 'SauceLabs',
24-
browserName: 'Android',
25-
platform: 'Linux',
26-
version: '4.4'
4F4C 16+
browserName: 'iphone',
17+
version: '10.3'
2718
},
2819
slAndroid5: {
2920
base: 'SauceLabs',

0 commit comments

Comments
 (0)
0