diff --git a/spec/error-stack-parser-spec.js b/spec/error-stack-parser-spec.js index 0244a12..adef64d 100644 --- a/spec/error-stack-parser-spec.js +++ b/spec/error-stack-parser-spec.js @@ -230,5 +230,13 @@ describe('ErrorStackParser', function() { expect(stackframes[0].lineNumber).toBe(2); expect(stackframes[0].columnNumber).toBe(9); }); + + it('should handle parentheses in Node.js stacks', function() { + var stackframes = unit.parse(CapturedExceptions.NODE_WITH_PARENTHESES); + expect(stackframes.length).toBe(7); + expect(stackframes[0].fileName).toEqual('/var/app/scratch/my project (top secret)/index.js'); + expect(stackframes[0].lineNumber).toBe(2); + expect(stackframes[0].columnNumber).toBe(9); + }); }); }); diff --git a/spec/fixtures/captured-errors.js b/spec/fixtures/captured-errors.js index 36c6856..8655f1b 100644 --- a/spec/fixtures/captured-errors.js +++ b/spec/fixtures/captured-errors.js @@ -397,3 +397,17 @@ CapturedExceptions.NODE_WITH_SPACES = { 'Function.Module.runMain (internal/modules/cjs/loader.js:837:10)\n at ' + 'internal/main/run_main_module.js:17:11' }; + +CapturedExceptions.NODE_WITH_PARENTHESES = { + name: 'Error', + message: '', + stack: 'Error\n at Object. ' + + '(/var/app/scratch/my ' + + 'project (top secret)/index.js:2:9)\n at Module._compile ' + + '(internal/modules/cjs/loader.js:774:30)\n at ' + + 'Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)\n ' + + ' at Module.load (internal/modules/cjs/loader.js:641:32)\n at ' + + 'Function.Module._load (internal/modules/cjs/loader.js:556:12)\n at ' + + 'Function.Module.runMain (internal/modules/cjs/loader.js:837:10)\n at ' + + 'internal/main/run_main_module.js:17:11' +}; \ No newline at end of file