Skip to content

Commit 105c371

Browse files
committed
Test for the ignoreUrls feature
1 parent 5164f5b commit 105c371

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ cross-domain requests.
7777
**signatureUrl** - Use a server side url to get a signature for the message.
7878
See below in the "Security" section for more details.
7979

80-
**ignoreErrors** - An array of error messages that should not get passed to sentry. You'll probably want to set this to `["Script error."]`.
80+
**ignoreErrors** - An array of error messages that should not get passed to
81+
Sentry. You'll probably want to set this to `["Script error."]`.
8182

82-
**ignoreUrls** - An array of regular expressions matching urls which will not get passed to sentry. Ie. you should set it to [/maps.google.com/] to avoid logging of errors which happens in Google Maps scripts or to [/jquery.js$/] to ignore errors in jquery library.
83+
**ignoreUrls** - An array of regular expressions matching urls which will not
84+
get passed to Sentry. For example, you could set it to
85+
`[/ajax\.googleapis\.com\/ajax\/libs\/jquery/i]` to ignore errors from the
86+
Google Hosted jQuery library.
8387

8488
## Logging Errors
8589

test/process.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ $(document).ready(function() {
6565
equal(ajax_calls.length, 0);
6666
});
6767

68+
test("should ignore urls passed in `ignoreUrls`", function() {
69+
Raven.process("Test error", "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js");
70+
71+
// Raven should bail before making an ajax call
72+
equal(ajax_calls.length, 0);
73+
});
74+
6875
test("should send a proper url", function() {
6976
Raven.process("Fail");
7077

test/test.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<title>Raven Test Suite</title>
5-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
66

77
<!-- jQuery or Zepto-->
88
<script type="text/javascript">
@@ -50,7 +50,8 @@ <h2 id="qunit-userAgent"></h2>
5050
"servers": ["/"],
5151
"signatureUrl": null,
5252
"testMode": true,
53-
"ignoreErrors": ["Error to ignore"]
53+
"ignoreErrors": ["Error to ignore"],
54+
"ignoreUrls": [/ajax\.googleapis\.com\/ajax\/libs\/jquery/i]
5455
};
5556
Raven.config(config_opts);
5657

0 commit comments

Comments
 (0)