You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 10, 2018. It is now read-only.
There is an interesting problem with newrelic here: the testing with mocha works quite well provided either newrellic is available, or a newrelic shim is used in event-controller.js. However, I cannot seem to find any particular way to reliably detect whether newrelic will work and then fallback to the shim. Mocha does throw-interceptions that cause the following code to just crash the mocha run:
varnewrelic;try{newrelic=require("newrelic");}catch(err){if(process.env.NODE_ENV==="development"){newrelic={addCustomParameter: function(){// no need to do anything}};}else{throwerr;}}
Mind you, this is the same trick we already use in server.js, but because things are wrapped by Mocha, this trick no longer works. The throw from the require call outright terminates the mocha run.
as it turns out, newrelicdoes not throw errors on require() (any throws it generates it self-catches and simply logs instead), so the try/catch we're using in server.js doesn't even do anything (tested that hypothesis, confirmed it by the catch block never actually running).
So, I'm going to solve this with a new, backward-compatible .env variable called WITHOUT_NEW_RELIC which, when set, effectis loading of a newrelic shim instead of the actual newrelic module.
MozillaFoundation/plan#351
The text was updated successfully, but these errors were encountered: