Comparing version 2.12.2 to 2.12.3
@@ -1,1 +0,1 @@ | ||
!function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){var n=o(1),t=o(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.12.2/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,e,o){var n=o(2);function t(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var a=0;function l(r,e){this.options=r,this._rollbarOldOnError=null;var o=a++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var i=o(3),s=function(r,e){return new l(r,e)},d=function(r){return new i(s,r)};function c(r){return t(function(){var e=Array.prototype.slice.call(arguments,0),o={shim:this,method:r,args:e,ts:new Date};window._rollbarShims[this.shimId()].messages.push(o)})}l.prototype.loadFull=function(r,e,o,n,a){var l=!1,i=e.createElement("script"),s=e.getElementsByTagName("script")[0],d=s.parentNode;i.crossOrigin="",i.src=n.rollbarJsUrl,o||(i.async=!0),i.onload=i.onreadystatechange=t(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){i.onload=i.onreadystatechange=null;try{d.removeChild(i)}catch(r){}l=!0,function(){var e;if(void 0===r._rollbarDidLoad){e=new Error("rollbar.js did not load");for(var o,n,t,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(t=n.args||[],i=0;i<t.length;++i)if("function"==typeof(l=t[i])){l(e);break}}"function"==typeof a&&a(e)}()}}),d.insertBefore(i,s)},l.prototype.wrap=function(r,e,o){try{var n;if(n="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){o&&"function"==typeof o&&o.apply(this,arguments);try{return r.apply(this,arguments)}catch(o){var e=o;throw e&&("string"==typeof e&&(e=new String(e)),e._rollbarContext=n()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e),e}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(e){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),u=0;u<p.length;++u)l.prototype[p[u]]=c(p[u]);r.exports={setupShim:function(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var a=new d(e);return t(function(){e.captureUncaught&&(a._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,a,!0),e.wrapGlobalEventHandlers&&n.wrapGlobals(r,a,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,a,!0);var t=e.autoInstrument;return!1!==e.enabled&&(void 0===t||!0===t||"object"==typeof t&&t.network)&&r.addEventListener&&(r.addEventListener("load",a.captureLoad.bind(a)),r.addEventListener("DOMContentLoaded",a.captureDomContentLoaded.bind(a))),r[o]=a,a})()}},Rollbar:d}},function(r,e){function o(r,e,o){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var n=e.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(e,o,t){n.call(this,e,r.wrap(o),t)};t._rollbarOldAdd=n,t.belongsToShim=o,e.addEventListener=t;for(var a=e.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,e,o){a.call(this,r,e&&e._rollbar_wrapped||e,o)};l._rollbarOldRemove=a,l.belongsToShim=o,e.removeEventListener=l}}r.exports={captureUncaughtExceptions:function(r,e,o){if(r){var n;if("function"==typeof e._rollbarOldOnError)n=e._rollbarOldOnError;else if(r.onerror){for(n=r.onerror;n._rollbarOldOnError;)n=n._rollbarOldOnError;e._rollbarOldOnError=n}e.handleAnonymousErrors();var t=function(){var o=Array.prototype.slice.call(arguments,0);!function(r,e,o,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null);var t=e.handleUncaughtException.apply(e,n);o&&o.apply(r,n),"anonymous"===t&&(e.anonymousErrorsPending+=1)}(r,e,n,o)};o&&(t._rollbarOldOnError=n),r.onerror=t}},captureUnhandledRejections:function(r,e,o){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var o,n,t;try{o=r.reason}catch(r){o=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!o&&t&&(o=t.reason,n=t.promise)}catch(r){}o||(o="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(o,n)};n.belongsToShim=o,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}},wrapGlobals:function(r,e,n){if(r){var t,a,l="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(t=0;t<l.length;++t)r[a=l[t]]&&r[a].prototype&&o(e,r[a].prototype,n)}}}},function(r,e){function o(r,e){this.impl=r(e,this),this.options=e,function(r){for(var e=function(r){return function(){var e=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,e)}},o="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<o.length;n++)r[o[n]]=e(o[n])}(o.prototype)}o.prototype._swapAndProcessMessages=function(r,e){var o,n,t;for(this.impl=r(this.options);o=e.shift();)n=o.method,t=o.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],o.ts]):this[n].apply(this,t));return this},r.exports=o},function(r,e){r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){for(var o,n,t=(r=r||{}).globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;o=window._rollbarShims[i++];)n||(n=o.handler),o.handler._swapAndProcessMessages(l,o.messages);window[t]=n,window._rollbarInitialized=!0}}}}]); | ||
!function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){var n=o(1),t=o(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.12.3/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,e,o){var n=o(2);function t(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var a=0;function l(r,e){this.options=r,this._rollbarOldOnError=null;var o=a++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var i=o(3),s=function(r,e){return new l(r,e)},d=function(r){return new i(s,r)};function c(r){return t(function(){var e=Array.prototype.slice.call(arguments,0),o={shim:this,method:r,args:e,ts:new Date};window._rollbarShims[this.shimId()].messages.push(o)})}l.prototype.loadFull=function(r,e,o,n,a){var l=!1,i=e.createElement("script"),s=e.getElementsByTagName("script")[0],d=s.parentNode;i.crossOrigin="",i.src=n.rollbarJsUrl,o||(i.async=!0),i.onload=i.onreadystatechange=t(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){i.onload=i.onreadystatechange=null;try{d.removeChild(i)}catch(r){}l=!0,function(){var e;if(void 0===r._rollbarDidLoad){e=new Error("rollbar.js did not load");for(var o,n,t,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(t=n.args||[],i=0;i<t.length;++i)if("function"==typeof(l=t[i])){l(e);break}}"function"==typeof a&&a(e)}()}}),d.insertBefore(i,s)},l.prototype.wrap=function(r,e,o){try{var n;if(n="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){o&&"function"==typeof o&&o.apply(this,arguments);try{return r.apply(this,arguments)}catch(o){var e=o;throw e&&("string"==typeof e&&(e=new String(e)),e._rollbarContext=n()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e),e}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(e){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),u=0;u<p.length;++u)l.prototype[p[u]]=c(p[u]);r.exports={setupShim:function(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var a=new d(e);return t(function(){e.captureUncaught&&(a._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,a,!0),e.wrapGlobalEventHandlers&&n.wrapGlobals(r,a,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,a,!0);var t=e.autoInstrument;return!1!==e.enabled&&(void 0===t||!0===t||"object"==typeof t&&t.network)&&r.addEventListener&&(r.addEventListener("load",a.captureLoad.bind(a)),r.addEventListener("DOMContentLoaded",a.captureDomContentLoaded.bind(a))),r[o]=a,a})()}},Rollbar:d}},function(r,e){function o(r,e,o){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var n=e.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(e,o,t){n.call(this,e,r.wrap(o),t)};t._rollbarOldAdd=n,t.belongsToShim=o,e.addEventListener=t;for(var a=e.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,e,o){a.call(this,r,e&&e._rollbar_wrapped||e,o)};l._rollbarOldRemove=a,l.belongsToShim=o,e.removeEventListener=l}}r.exports={captureUncaughtExceptions:function(r,e,o){if(r){var n;if("function"==typeof e._rollbarOldOnError)n=e._rollbarOldOnError;else if(r.onerror){for(n=r.onerror;n._rollbarOldOnError;)n=n._rollbarOldOnError;e._rollbarOldOnError=n}e.handleAnonymousErrors();var t=function(){var o=Array.prototype.slice.call(arguments,0);!function(r,e,o,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null);var t=e.handleUncaughtException.apply(e,n);o&&o.apply(r,n),"anonymous"===t&&(e.anonymousErrorsPending+=1)}(r,e,n,o)};o&&(t._rollbarOldOnError=n),r.onerror=t}},captureUnhandledRejections:function(r,e,o){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var o,n,t;try{o=r.reason}catch(r){o=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!o&&t&&(o=t.reason,n=t.promise)}catch(r){}o||(o="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(o,n)};n.belongsToShim=o,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}},wrapGlobals:function(r,e,n){if(r){var t,a,l="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(t=0;t<l.length;++t)r[a=l[t]]&&r[a].prototype&&o(e,r[a].prototype,n)}}}},function(r,e){function o(r,e){this.impl=r(e,this),this.options=e,function(r){for(var e=function(r){return function(){var e=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,e)}},o="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<o.length;n++)r[o[n]]=e(o[n])}(o.prototype)}o.prototype._swapAndProcessMessages=function(r,e){var o,n,t;for(this.impl=r(this.options);o=e.shift();)n=o.method,t=o.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],o.ts]):this[n].apply(this,t));return this},r.exports=o},function(r,e){r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){for(var o,n,t=(r=r||{}).globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;o=window._rollbarShims[i++];)n||(n=o.handler),o.handler._swapAndProcessMessages(l,o.messages);window[t]=n,window._rollbarInitialized=!0}}}}]); |
@@ -72,2 +72,7 @@ // Type definitions for rollbar | ||
captureLambdaTimeouts?: boolean; | ||
nodeSourceMaps?: boolean; | ||
inspectAnonymousErrors?: boolean; | ||
ignoreDuplicateErrors?: boolean; | ||
wrapGlobalEventHandlers?: boolean; | ||
scrubRequestBody?: boolean; | ||
transform?: (data: object) => void; | ||
@@ -74,0 +79,0 @@ checkIgnore?: (isUncaught: boolean, args: LogArgument[], item: object) => boolean; |
{ | ||
"name": "rollbar", | ||
"version": "2.12.2", | ||
"version": "2.12.3", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
# Rollbar.js | ||
[![Build Status](https://api.travis-ci.org/rollbar/rollbar.js.png?branch=v2.12.2)](https://travis-ci.org/rollbar/rollbar.js) | ||
[![Build Status](https://api.travis-ci.org/rollbar/rollbar.js.png?branch=v2.12.3)](https://travis-ci.org/rollbar/rollbar.js) | ||
[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/context:javascript) | ||
@@ -5,0 +5,0 @@ [![Total Alerts](https://img.shields.io/lgtm/alerts/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/alerts) |
@@ -75,2 +75,3 @@ var _ = require('../utility'); | ||
this.rollbar = rollbar; | ||
this.diagnostic = rollbar.client.notifier.diagnostic; | ||
this._window = _window || {}; | ||
@@ -378,2 +379,4 @@ this._document = _document || {}; | ||
function wrapConsole(method) { | ||
'use strict'; // See https://github.com/rollbar/rollbar.js/pull/778 | ||
var orig = c[method]; | ||
@@ -393,4 +396,8 @@ var origConsole = c; | ||
var methods = ['debug','info','warn','error','log']; | ||
for (var i=0, len=methods.length; i < len; i++) { | ||
wrapConsole(methods[i]); | ||
try { | ||
for (var i=0, len=methods.length; i < len; i++) { | ||
wrapConsole(methods[i]); | ||
} | ||
} catch (e) { | ||
this.diagnostic.instrumentConsole = { error: e.message }; | ||
} | ||
@@ -397,0 +404,0 @@ }; |
@@ -16,2 +16,3 @@ var _ = require('./utility'); | ||
this.transforms = []; | ||
this.diagnostic = {}; | ||
} | ||
@@ -18,0 +19,0 @@ |
@@ -85,3 +85,3 @@ var _ = require('./utility'); | ||
function addDiagnosticKeys(item, options, callback) { | ||
var diagnostic = {} | ||
var diagnostic = _.merge(item.notifier.client.notifier.diagnostic, item.diagnostic); | ||
@@ -88,0 +88,0 @@ if (_.get(item, 'err._isAnonymous')) { |
@@ -388,2 +388,3 @@ var merge = require('./merge'); | ||
var extraArgs = []; | ||
var diagnostic = {}; | ||
@@ -451,2 +452,4 @@ for (var i = 0, l = args.length; i < l; ++i) { | ||
callback: callback, | ||
notifier: notifier, | ||
diagnostic: diagnostic, | ||
uuid: uuid4() | ||
@@ -453,0 +456,0 @@ }; |
@@ -44,5 +44,9 @@ /* globals expect */ | ||
describe('Rollbar()', function() { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
}); | ||
it('should have all of the expected methods with a real client', function(done) { | ||
var options = {}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -63,3 +67,3 @@ expect(rollbar).to.have.property('log'); | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -80,3 +84,3 @@ expect(rollbar).to.have.property('log'); | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -94,3 +98,3 @@ expect(rollbar.options.scrubFields).to.contain('password'); | ||
}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -110,3 +114,3 @@ expect(rollbar.options.scrubFields).to.contain('foobar'); | ||
}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -121,3 +125,3 @@ expect(rollbar.options.scrubFields).to.contain('foobar'); | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -133,3 +137,3 @@ var result = rollbar.log('a messasge', 'another one'); | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -147,3 +151,3 @@ var result = rollbar.log('a message', 'another one'); | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -163,2 +167,6 @@ var methods = 'log,debug,info,warn,warning,error,critical'.split(','); | ||
describe('configure', function() { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
}); | ||
it('should configure client', function(done) { | ||
@@ -172,3 +180,3 @@ var client = new (TestClientGen())(); | ||
}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
expect(rollbar.options.payload.environment).to.eql('testtest'); | ||
@@ -189,3 +197,3 @@ | ||
}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
expect(rollbar.options.payload.environment).to.eql('testtest'); | ||
@@ -207,3 +215,3 @@ | ||
}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
expect(rollbar.options.payload.environment).to.eql('testtest'); | ||
@@ -226,3 +234,3 @@ | ||
}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
expect(rollbar.options._configuredOptions.payload.environment).to.eql('testtest'); | ||
@@ -239,3 +247,3 @@ expect(rollbar.options._configuredOptions.captureUncaught).to.eql(true); | ||
describe('options.captureUncaught', function() { | ||
before(function (done) { | ||
beforeEach(function (done) { | ||
// Load the HTML page, so errors can be generated. | ||
@@ -248,3 +256,4 @@ document.write(window.__html__['examples/error.html']); | ||
after(function () { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
window.server.restore(); | ||
@@ -272,3 +281,3 @@ }); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -305,3 +314,3 @@ var element = document.getElementById('throw-error'); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -355,3 +364,3 @@ element.click(); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -394,3 +403,3 @@ // Simulate receiving onerror without an error object. | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -433,3 +442,3 @@ var element = document.getElementById('throw-error'); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -470,3 +479,3 @@ var element = document.getElementById('throw-error'); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -495,3 +504,3 @@ var element = document.getElementById('throw-dom-exception'); | ||
describe('options.captureUnhandledRejections', function() { | ||
before(function (done) { | ||
beforeEach(function (done) { | ||
window.server = sinon.createFakeServer(); | ||
@@ -501,3 +510,4 @@ done(); | ||
after(function () { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
window.server.restore(); | ||
@@ -525,3 +535,3 @@ }); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -556,3 +566,3 @@ Promise.reject(new Error('test reject')); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -593,3 +603,3 @@ rollbar.configure({ | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -616,3 +626,3 @@ rollbar.configure({ | ||
describe('log', function() { | ||
before(function (done) { | ||
beforeEach(function (done) { | ||
window.server = sinon.createFakeServer(); | ||
@@ -622,3 +632,4 @@ done(); | ||
after(function () { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
window.server.restore(); | ||
@@ -646,3 +657,3 @@ }); | ||
}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -663,3 +674,3 @@ rollbar.log(null); | ||
describe('onerror', function() { | ||
before(function (done) { | ||
beforeEach(function (done) { | ||
window.server = sinon.createFakeServer(); | ||
@@ -669,3 +680,4 @@ done(); | ||
after(function () { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
window.server.restore(); | ||
@@ -693,3 +705,3 @@ }); | ||
}; | ||
new Rollbar(options); | ||
window.rollbar = new Rollbar(options); | ||
@@ -709,6 +721,88 @@ window.onerror("TestRollbarError: testing window.onerror", window.location.href); | ||
describe('options.autoInstrument.log', function() { | ||
beforeEach(function (done) { | ||
window.server = sinon.createFakeServer(); | ||
done(); | ||
}); | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
window.server.restore(); | ||
}); | ||
function stubResponse(server) { | ||
server.respondWith('POST', 'api/1/item', | ||
[ | ||
200, | ||
{ 'Content-Type': 'application/json' }, | ||
'{"err": 0, "result":{ "uuid": "d4c7acef55bf4c9ea95e4fe9428a8287"}}' | ||
] | ||
); | ||
} | ||
it('should add telemetry events when console.log is called', function(done) { | ||
var server = window.server; | ||
stubResponse(server); | ||
server.requests.length = 0; | ||
var options = { | ||
accessToken: 'POST_CLIENT_ITEM_TOKEN' | ||
}; | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
console.log('console test'); // generate a telemetry event | ||
rollbar.log('test'); // generate a payload to inspect | ||
server.respond(); | ||
var body = JSON.parse(server.requests[0].requestBody); | ||
expect(body.data.body.telemetry[0].body.message).to.eql('console test'); | ||
done(); | ||
}); | ||
it('should add a diagnostic message when wrapConsole fails', function(done) { | ||
var server = window.server; | ||
stubResponse(server); | ||
server.requests.length = 0; | ||
var oldConsole = window.console; | ||
var newConsole = {} | ||
Object.defineProperty( newConsole, 'log', { | ||
get: function () { | ||
return function(message) { oldConsole.log(message); return message; }; | ||
} | ||
}); | ||
window.console = newConsole; | ||
var options = { | ||
accessToken: 'POST_CLIENT_ITEM_TOKEN' | ||
}; | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
rollbar.log('test'); // generate a payload to inspect | ||
server.respond(); | ||
var body = JSON.parse(server.requests[0].requestBody); | ||
window.console = oldConsole; | ||
expect(rollbar.client.notifier.diagnostic.instrumentConsole).to.have.property('error'); | ||
expect(body.data.notifier.diagnostic.instrumentConsole).to.have.property('error'); | ||
done(); | ||
}); | ||
}); | ||
describe('captureEvent', function() { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
}); | ||
it('should handle missing/default type and level', function(done) { | ||
var options = {}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -724,3 +818,3 @@ var event = rollbar.captureEvent({foo: 'bar'}); | ||
var options = {}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -736,3 +830,3 @@ var event = rollbar.captureEvent('log', {foo: 'bar'}, 'debug'); | ||
var options = {}; | ||
var rollbar = new Rollbar(options); | ||
var rollbar = window.rollbar = new Rollbar(options); | ||
@@ -749,6 +843,10 @@ var event = rollbar.captureEvent('meaningless', {foo: 'bar'}, 23); | ||
describe('createItem', function() { | ||
afterEach(function () { | ||
window.rollbar.configure({ autoInstrument: false }); | ||
}); | ||
it('should handle multiple strings', function(done) { | ||
var client = new (TestClientGen())(); | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -765,3 +863,3 @@ var args = ['first', 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -779,3 +877,3 @@ var args = [new Error('Whoa'), 'first', 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -800,3 +898,3 @@ var myCallbackCalled = false; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -815,3 +913,3 @@ var args = [new Error('Whoa'), 'first', [1, 2, 3], 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -831,3 +929,3 @@ var args = [new Error('Whoa'), 'first', {a: 1, b: 2}, 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -844,3 +942,3 @@ var args = [new Error('Whoa'), 'first', {a: 1, b: 2}, 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -861,3 +959,3 @@ var args = [new Error('Whoa'), 'first', {a: 1, b: 2}, 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -874,3 +972,3 @@ var y2k = new Date(2000, 0, 1) | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -886,3 +984,3 @@ var args = [new Error('Whoa'), 'first', 42, {a: 1, b: 2}, 'second']; | ||
var options = {}; | ||
var rollbar = new Rollbar(options, client); | ||
var rollbar = window.rollbar = new Rollbar(options, client); | ||
@@ -889,0 +987,0 @@ if (document && document.querySelectorAll) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3479094
41172