raven-for-redux icon indicating copy to clipboard operation
raven-for-redux copied to clipboard

Jest Test Error

Open Quadriphobs1 opened this issue 7 years ago • 2 comments

I installed the sentry package and integrated this package for redux which is working fine not until in started using the package on some component I have tested with jest and I keep getting a very weird error TypeError: Cannot use 'in' operator to search for 'fetch' in true which has to deal with raven.

Now if i remove it from the component the test seems to go, any idea

Quadriphobs1 avatar Sep 12 '18 09:09 Quadriphobs1

@Quadriphobs1 Don't know if this is going to lead anywhere, but adding the following to jest.config.js at least resolves the compile error:

const window = {
    addEventListener: () => {
    },

    removeEventListener: () => {
    },
};

module.exports = {
    ...
    "globals": {
        "window": window,
        ...
    },
};

AndriiNeverov avatar Jun 18 '19 01:06 AndriiNeverov

Odd. I'm guessing that adding raven-for-redux results in some Raven code which tries to use window.fetch getting called. Do you have JS-DOM enabled in Jest?

Do you have a full stack trace you could share?

captbaritone avatar Dec 19 '19 04:12 captbaritone