From a3699bed48a9fa7cdb59c6d30e46149abdb242db Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 6 Mar 2018 23:01:44 +0000 Subject: [PATCH 1/4] Fix spaces in paths --- package.json | 2 +- test/fixtures/file with spaces in path.js | 3 +++ test/raven.utils.js | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/file with spaces in path.js diff --git a/package.json b/package.json index e0ac520..f9cddb9 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dependencies": { "cookie": "0.3.1", "md5": "^2.2.1", - "stack-trace": "0.0.9", + "stack-trace": "0.0.10", "timed-out": "4.0.1", "uuid": "3.0.0" }, diff --git a/test/fixtures/file with spaces in path.js b/test/fixtures/file with spaces in path.js new file mode 100644 index 0000000..569e2a6 --- /dev/null +++ b/test/fixtures/file with spaces in path.js @@ -0,0 +1,3 @@ +module.exports = function() { + throw new Error('boom'); +}; diff --git a/test/raven.utils.js b/test/raven.utils.js index b20ff01..5be09f3 100644 --- a/test/raven.utils.js +++ b/test/raven.utils.js @@ -280,6 +280,21 @@ describe('raven.utils', function() { raven.utils.parseStack(e, parseCallback); } }); + + it('should handle spaces in paths', function(done) { + var parseStack = raven.utils.parseStack; + var callback = function(frames) { + var frame = frames.pop(); + frame.module.should.equal('file with spaces in path'); + frame.filename.should.endWith('ile with spaces in path.js'); + done(); + }; + try { + require('./fixtures/file with spaces in path')(); + } catch (e) { + parseStack(e, callback); + } + }); }); describe('#getCulprit()', function() { From 2f5123c63fa489ab0fca07949c7b8707e188bc3d Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 6 Mar 2018 23:06:53 +0000 Subject: [PATCH 2/4] typo in test --- test/raven.utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/raven.utils.js b/test/raven.utils.js index 5be09f3..4353e7e 100644 --- a/test/raven.utils.js +++ b/test/raven.utils.js @@ -286,7 +286,7 @@ describe('raven.utils', function() { var callback = function(frames) { var frame = frames.pop(); frame.module.should.equal('file with spaces in path'); - frame.filename.should.endWith('ile with spaces in path.js'); + frame.filename.should.endWith('file with spaces in path.js'); done(); }; try { From 0d91cb6c4ab9f9937e0ce26c3af5a0bf5bfc456d Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 6 Mar 2018 23:12:54 +0000 Subject: [PATCH 3/4] looks like there is a different module on Linux/Travis --- test/raven.utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/raven.utils.js b/test/raven.utils.js index 4353e7e..66d1044 100644 --- a/test/raven.utils.js +++ b/test/raven.utils.js @@ -285,7 +285,7 @@ describe('raven.utils', function() { var parseStack = raven.utils.parseStack; var callback = function(frames) { var frame = frames.pop(); - frame.module.should.equal('file with spaces in path'); + frame.module.should.equal('fixtures:file with spaces in path'); frame.filename.should.endWith('file with spaces in path.js'); done(); }; From 94ccf9336af4a648638860c766e9e91e214c0f99 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 6 Mar 2018 23:15:46 +0000 Subject: [PATCH 4/4] endswith --- test/raven.utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/raven.utils.js b/test/raven.utils.js index 66d1044..60ff1e9 100644 --- a/test/raven.utils.js +++ b/test/raven.utils.js @@ -285,7 +285,7 @@ describe('raven.utils', function() { var parseStack = raven.utils.parseStack; var callback = function(frames) { var frame = frames.pop(); - frame.module.should.equal('fixtures:file with spaces in path'); + frame.module.should.endWith('file with spaces in path'); frame.filename.should.endWith('file with spaces in path.js'); done(); };