Fix stack trace if there are anonymous functions in stack trace#24
Fix stack trace if there are anonymous functions in stack trace#24steren merged 2 commits intoGoogleCloudPlatform:masterfrom Jastrzebowski:feature-21-anonymous-in-stack-trace
Conversation
* Add <anonymous> in stack trace if there is no functionName * Add command using scripts in package.json * Add tests * Remove unused code in test.html * Update version in package lock * Update readme to include test instructions
|
Thanks a lot, I will take a closer look within a day. |
steren
left a comment
There was a problem hiding this comment.
Thanks for the PR. One small comment on the test.
| } | ||
| }); | ||
|
|
||
| it('should extract and send <anonymous> in stack traces', function (done) { |
There was a problem hiding this comment.
Could you update the test name to
"should set in stack traces when frame is anonymous"
| * Run `gulp` to test your changes. | ||
| * Run `gulp dist` generates the minified version. | ||
| * Run `npm test` or `yarn run test` to test your changes. | ||
| * Run `npm run dist` or `yarn run dist` generates the minified version. |
There was a problem hiding this comment.
Thanks for the improvements!
There was a problem hiding this comment.
You're welcome, still, find NPM scripts an underappreciated feature :) perfect for simple commands.
| throwError(message) | ||
| } catch(e) { | ||
| errorHandler.report(e, function() { | ||
| expectRequestWithMessage('<anonymous>'); |
There was a problem hiding this comment.
Here, it implicitly relies on the internal implementation of Mocha (Mocha uses anonymous functions in its execution)
Could you instead use an anonymous function in this test file? So that we can clearly understand why the stack will contain
|
Due to the fact that the sent stacktraces might contain more frames (with ), which might impact the error grouping algorithm, when this change is merged, I will increment the major version of the library. |
* Update test message * Use explicite anonymous function in anonymous test case
<anonymous>in stack trace if there is no functionNameProblem with issue #21 is due to errors thrown in anonymous scope, V8 stack trace format expects
<anonymous>in this case. I've added a simple fallback for this case and some tests to try it (I'm not 100% happy with anonymous one but I have no idea how to throw an error in the global anonymous scope from inside the tests). Still, I think we should review the whole V8 format and check if we cover every case and definitely write tests to cover all the cases.As for other changes, I've added scripts commands in
package.jsonso no global Gulp required anymore — Readme updated too.