Skip to content

Commit 73a05a4

Browse files
committed
Added sample exception and a test.
1 parent 6826bc9 commit 73a05a4

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ It is currently tested and working on:
6969
- K-Meleon 1.5.3+
7070
- Epiphany 2.28.0+
7171
- Iceape 1.1+
72+
- PhantomJS
7273

7374
## Contributions [![Stories in Ready](http://badge.waffle.io/eriwen/javascript-stacktrace.png)](http://waffle.io/eriwen/javascript-stacktrace)
7475

test/CapturedExceptions.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,20 @@ CapturedExceptions.node_simple = {
350350
' at ReadStream.onkeypress (readline.js:99:10)',
351351
'arguments': [ 'x' ]
352352
};
353+
354+
CapturedExceptions.phantomjs = {
355+
message: "'undefined' is not a function (evaluating 'this.undef()')",
356+
line: 852,
357+
sourceId: 163911584,
358+
sourceURL: 'http://localhost:10015/packages/peerdb.js?fe1089e34c777737beadb68e0657ca0bbe2e54b4',
359+
name: 'TypeError',
360+
stack: "TypeError: 'undefined' is not a function (evaluating 'this.undef()')\n" +
361+
' at http://localhost:10015/packages/peerdb.js?fe1089e34c777737beadb68e0657ca0bbe2e54b4:852\n' +
362+
' at http://localhost:10015/packages/meteor-peerdb:tests.js?36eb638af853e313daf7222afac0edaf9eb3bbc6:4476\n' +
363+
' at http://localhost:10015/packages/meteor-peerdb:tests.js?36eb638af853e313daf7222afac0edaf9eb3bbc6:4481\n' +
364+
' at http://localhost:10015/packages/tinytest.js?3fa2a6f5f9fadecfe9cf5d3420b3a1c719407388:393\n' +
365+
' at http://localhost:10015/packages/meteor.js?148e9381d225ecad703f4b858769b636ff7a2537:794\n' +
366+
' at http://localhost:10015/packages/meteor.js?148e9381d225ecad703f4b858769b636ff7a2537:379\n' +
367+
' at http://localhost:10015/packages/meteor.js?148e9381d225ecad703f4b858769b636ff7a2537:822\n' +
368+
' at onGlobalMessage (http://localhost:10015/packages/meteor.js?148e9381d225ecad703f4b858769b636ff7a2537:316)'
369+
};

test/TestStacktrace.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
};
5353
},
5454
createModeStubs: function(p, stub) {
55-
var modes = ['other', 'opera9', 'opera10a', 'opera10b', 'opera11', 'firefox', 'safari', 'ie', 'chrome'];
55+
var modes = ['other', 'opera9', 'opera10a', 'opera10b', 'opera11', 'firefox', 'safari', 'ie', 'chrome', 'phantomjs'];
5656
for (var i = 0, len = modes.length; i < len; i++) {
5757
var mode = modes[i];
5858
p[mode] = stub || this.createModeStub(mode);
@@ -88,7 +88,7 @@
8888

8989
test("mode", function() {
9090
expect(1);
91-
equals("chrome safari firefox ie other opera9 opera10a opera10b opera11".indexOf(pst.mode(UnitTest.fn.createGenericError())) >= 0, true);
91+
equals("chrome safari firefox ie other opera9 opera10a opera10b opera11 phantomjs".indexOf(pst.mode(UnitTest.fn.createGenericError())) >= 0, true);
9292
});
9393

9494
test("run mode", function() {
@@ -531,6 +531,16 @@
531531
equals(message[2], 'onclick@http://jenkins.eriwen.com/job/stacktrace.js/ws/test/functional/ExceptionLab.html:82:1');
532532
});
533533

534+
test("phantomjs", function() {
535+
var e = [CapturedExceptions.phantomjs];
536+
expect(2); // 2 * e.length
537+
for (var i = 0; i < e.length; i++) {
538+
var message = pst.phantomjs(e[i]);
539+
equals(message.length, 8, 'number of stack entries');
540+
equals(message[message.length - 1].indexOf('onGlobalMessage()') >= 0, true, 'onGlobalMessage() is 1st from the bottom of stack');
541+
}
542+
});
543+
534544
test("other", function() {
535545
expect(5);
536546
var results = [];

0 commit comments

Comments
 (0)