forked from bluesmoon/boomerang
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= header %> | ||
<%= boomerangScript %> | ||
<script src="21-max-stack.js" type="text/javascript"></script> | ||
<script> | ||
BOOMR_test.init({ | ||
testAfterOnBeacon: true, | ||
Errors: { | ||
enabled: true | ||
} | ||
}); | ||
|
||
var stack = ""; | ||
for (var i = 0; i < 10000; i++) { | ||
stack += "a"; | ||
} | ||
|
||
BOOMR.plugins.Errors.send({ | ||
stack: stack, | ||
message: "a is not defined" | ||
}); | ||
</script> | ||
<%= footer %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*eslint-env mocha*/ | ||
/*global BOOMR_test,assert*/ | ||
|
||
describe("e2e/14-errors/21-max-stack", function() { | ||
var tf = BOOMR.plugins.TestFramework; | ||
var t = BOOMR_test; | ||
var C = BOOMR.utils.Compression; | ||
|
||
it("Should have sent a single beacon", function(done) { | ||
t.validateBeaconWasSent(done); | ||
}); | ||
|
||
it("Should have put the err on the beacon", function() { | ||
var b = tf.lastBeacon(); | ||
assert.isDefined(b.err); | ||
}); | ||
|
||
it("Should have had 1 error", function() { | ||
var b = tf.lastBeacon(); | ||
assert.equal(C.jsUrlDecompress(b.err).length, 1); | ||
}); | ||
|
||
it("Should have had a stack with a max length of around 5000 chars", function() { | ||
var b = tf.lastBeacon(); | ||
var err = BOOMR.plugins.Errors.decompressErrors(C.jsUrlDecompress(b.err))[0]; | ||
|
||
// allow for some wiggle room in message length, but close to 5000 | ||
assert.closeTo(err.stack.length, "a is not defined".length + 5000, 10, "stack: " + err.stack); | ||
}); | ||
}); |