Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix(longStackTraceZone): modifies stackFramesFilter to exclude zone.j…
Browse files Browse the repository at this point in the history
…s frames
  • Loading branch information
Matthew Hill authored and vicb committed Sep 8, 2015
1 parent 1897440 commit 50ce9f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/zones/long-stack-trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = {
},

stackFramesFilter: function (line) {
return /zone(-microtask)?(\.min)?\.js/.test(line);
return !/zone(-microtask)?(\.min)?\.js/.test(line);
},

onError: function (exception) {
Expand Down
8 changes: 8 additions & 0 deletions test/long-stack-trace-zone.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('longStackTraceZone', function () {
setTimeout(function () {
setTimeout(function () {
expect(log[0]).toBe('Error: hello');

expect(log[1].split('--- ').length).toBe(4);
done();
}, 0);
Expand All @@ -28,6 +29,13 @@ describe('longStackTraceZone', function () {
});
});

it('should filter out zone.js frames with default stackFramesFilter impl', function () {
var zoneFrame = 'at Zone.bind (http://localhost:8080/node_modules/zone.js/dist/zone.js:84:48)';
var nonZoneFrame = 'at a (http://localhost:8080/index.js:7:3)';

expect(lstz.stackFramesFilter(zoneFrame)).toBe(false);
expect(lstz.stackFramesFilter(nonZoneFrame)).toBe(true);
});

it('should filter based on stackFramesFilter', function (done) {
lstz.fork({
Expand Down

0 comments on commit 50ce9f3

Please sign in to comment.