How can I fix my mocha Javascript tests for Raven/Sentry?

146 Views Asked by At

Half of the time that I run my tests (npm test) I get the following stack trace and it's very misleading. Any idea how I could solve this?

/node_modules/raven/lib/client.js:217
    kwargs.user = extend({}, this._globalContext.user, domainContext.user, kwargs.user);
                                                 ^
TypeError: Cannot read property 'user' of undefined
    at Raven.process (..node_modules/raven/lib/client.js:217:50)
    at ..node_modules/raven/lib/client.js:375:12
    at ..node_modules/raven/lib/parsers.js:55:5
    at ..node_modules/raven/lib/utils.js:259:5
    at ..node_modules/raven/lib/utils.js:169:35
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
1

There are 1 best solutions below

0
Kamilski81 On

After upgrading to @sentry/node things got much better and my tests have now been passing consistently.