Skip to content

Commit 50e20b6

Browse files
committed
added issue #10 as a test case
1 parent 3b4e7f4 commit 50e20b6

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ var create_callsite = function(location) {
5858
};
5959

6060
Error.prepareStackTrace = function(error, structured_stack_trace) {
61+
// console.log('Error.prepareStackTrace');
62+
6163
error.__cached_trace__ = structured_stack_trace.filter(function(f) {
6264
return f.getFileName() !== filename;
6365
});

test/test-longjohn.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,32 @@ describe('longjohn', function() {
2626
}, 1);
2727
});
2828

29+
it('should work for issue #10', function(done) {
30+
function a(){
31+
b();
32+
}
33+
34+
function b(){
35+
assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 2);
36+
return done();
37+
}
38+
39+
setTimeout(a, 0);
40+
});
41+
42+
it('should work for issue #10-2', function(done) {
43+
function a(){
44+
setTimeout(b, 0);
45+
}
46+
47+
function b(){
48+
assert.equal(new Error('this is uncaught!').stack.split(longjohn.empty_frame).length, 3);
49+
return done();
50+
}
51+
52+
setTimeout(a, 0);
53+
});
54+
2955
it('should allow stack size limiting', function(done) {
3056
longjohn.async_trace_limit = 2;
3157

0 commit comments

Comments
 (0)