[Node] New Relic triggers error when running tests

using the following code:
const newrelic = require(“newrelic”);

newrelic.noticeError(“failed something”);

getting this error when running tests using jest

TypeError: Right-hand side of ‘instanceof’ is not callable
at ConcatStream.Writable (node_modules/readable-stream/lib/_stream_writable.js:239:23)
at new ConcatStream (node_modules/concat-stream/index.js:32:12)
at ConcatStream (node_modules/concat-stream/index.js:12:47)
at ClientRequest.awsRequest (node_modules/newrelic/lib/utilization/common.js:70:14)

when removing newrelic code, it passes

Hey there lgordin,

Thanks for reaching out to New Relic Support! I’m more than happy to provide some insight on you situation at hand.

Per your snap shot of your error above, it seems to me that you’re not using instanceof correctly in this particular situation. instanceof is used to see if an object is an instance of a specific constructor ex: `banned instanceof Array`. I would try enabling noticeError if you haven’t already as this will provide greater insight into any error that’s thrown without disrupting your application’s performance. I’ve included the links below.

NoticeError with browser agent

Notice error in implementation

Please don’t hesitate to reach out if you have any other questions or comments!

Cheers,
Emory Schwall
Java and Node.js TSE