Skip to content

Commit fa86837

Browse files
committed
Basic jQuery plugin test
1 parent 64ca528 commit fa86837

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
"chai": "~1.8.1",
1717
"grunt": "~0.4.1",
1818
"grunt-cli": "~0.1.9",
19+
"grunt-contrib-clean": "~0.4.0",
20+
"grunt-contrib-concat": "~0.3.0",
21+
"grunt-contrib-connect": "~0.5.0",
22+
"grunt-contrib-copy": "~0.4.1",
1923
"grunt-contrib-jshint": "~0.6.3",
2024
"grunt-contrib-uglify": "~0.2.2",
21-
"grunt-contrib-concat": "~0.3.0",
22-
"grunt-contrib-clean": "~0.4.0",
25+
"grunt-gitinfo": "~0.1.1",
2326
"grunt-mocha": "~0.4.1",
2427
"grunt-release": "~0.6.0",
2528
"grunt-s3": "~0.2.0-alpha.3",
26-
"grunt-gitinfo": "~0.1.1",
27-
"grunt-contrib-connect": "~0.5.0",
28-
"grunt-contrib-copy": "~0.4.1",
29-
"sinon": "~1.7.3",
30-
"lodash": "~2.4.0"
29+
"jquery": "^2.1.4",
30+
"lodash": "~2.4.0",
31+
"sinon": "~1.7.3"
3132
}
3233
}

test/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@
2828
});
2929
</script>
3030

31+
<!-- Deps -->
32+
<script src="../node_modules/jquery/dist/jquery.js"></script>
33+
3134
<!-- Raven -->
3235
<script src="../vendor/TraceKit/tracekit.js"></script>
3336
<script src="../src/raven.js"></script>
37+
<script src="../plugins/jquery.js"></script>
3438

3539
<!-- Tests -->
3640
<script src="raven.test.js"></script>
41+
<script src="plugins/jquery.test.js"></script>
3742

3843
<script>
3944
if (!window.PHANTOMJS) {
@@ -53,7 +58,9 @@
5358

5459
runner.on('end', function(){
5560
runner.stats.failed = failed;
56-
global.mochaResults = runner.stats;
61+
if (typeof global !== "undefined") {
62+
global.mochaResults = runner.stats;
63+
}
5764
});
5865
})(mocha.run());
5966
}

test/plugins/jquery.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
describe('jQuery', function(){
2+
describe('.fn.ready', function(){
3+
it('captures exceptions #integration', function(){
4+
var err = new Error('foo');
5+
this.sinon.stub(Raven, 'captureException')
6+
try {
7+
jQuery(function(){
8+
throw err;
9+
});
10+
} catch (err2) {
11+
if (err2 !== err) throw err2;
12+
}
13+
assert.isTrue(Raven.captureException.called);
14+
assert.equal(Raven.captureException.lastCall.args[0], err);
15+
});
16+
});
17+
});

0 commit comments

Comments
 (0)