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

Commit 50ce9f3

Browse files
Matthew Hillvicb
authored andcommitted
fix(longStackTraceZone): modifies stackFramesFilter to exclude zone.js frames
1 parent 1897440 commit 50ce9f3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/zones/long-stack-trace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = {
6969
},
7070

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

7575
onError: function (exception) {

test/long-stack-trace-zone.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('longStackTraceZone', function () {
1919
setTimeout(function () {
2020
setTimeout(function () {
2121
expect(log[0]).toBe('Error: hello');
22+
2223
expect(log[1].split('--- ').length).toBe(4);
2324
done();
2425
}, 0);
@@ -28,6 +29,13 @@ describe('longStackTraceZone', function () {
2829
});
2930
});
3031

32+
it('should filter out zone.js frames with default stackFramesFilter impl', function () {
33+
var zoneFrame = 'at Zone.bind (http://localhost:8080/node_modules/zone.js/dist/zone.js:84:48)';
34+
var nonZoneFrame = 'at a (http://localhost:8080/index.js:7:3)';
35+
36+
expect(lstz.stackFramesFilter(zoneFrame)).toBe(false);
37+
expect(lstz.stackFramesFilter(nonZoneFrame)).toBe(true);
38+
});
3139

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

0 commit comments

Comments
 (0)