Skip to content

Instantly share code, notes, and snippets.

@eojthebrave
Created March 19, 2015 22:35
Show Gist options
  • Save eojthebrave/5e733250bbcd3fdf0c69 to your computer and use it in GitHub Desktop.
Save eojthebrave/5e733250bbcd3fdf0c69 to your computer and use it in GitHub Desktop.
Skip external resources requested when running casperjs tests
casper.options.onResourceRequested = function(casper, requestData, request) {
// If any of these strings are found in the requested resource's URL, skip
// this request. These are not required for running tests.
var skip = [
'.kissmetrics.com',
'googleads.g.doubleclick.net',
'www.googleadservices.com'
];
skip.forEach(function(needle) {
if (requestData.url.indexOf(needle) > 0) {
request.abort();
}
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment