captbaritone / raven-for-redux

A Raven middleware for Redux
295 stars 25 forks source link

Jest Test Error #91

Open Quadriphobs1 opened 6 years ago

Quadriphobs1 commented 6 years ago

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

AndriiNeverov commented 5 years ago

@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,
        ...
    },
};
captbaritone commented 4 years ago

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?