Describe the bug
I have a React Native project and was able to setup reactotron-react-native and my tests were still working fine, but as soon as I installed reactotron-redux and set it up as per documentation, all my tests started failing with the following error - SyntaxError: Cannot use import statement outside a module.
If I remove .use(reactotronRedux()) from ReactotronConfig.js the tests start passing again. There doesn't seem to be any documentation regarding mocking so I've found my mock from other Reactotron github issues, but none of them are working for me.
I am on the latest verions of both reactotron-react-native and reactotron-redux
The error looks like this:
SyntaxError: Cannot use import statement outside a module
4 | const reactotron = Reactotron.configure() // controls connection & communication settings
5 | .useReactNative() // add all built-in react native plugins
> 6 | .use(reactotronRedux())
| ^
7 | .connect(); // let's connect!
8 |
9 | export default reactotron;
ReactotronConfig.js
const Reactotron = require('reactotron-react-native').default;
const { reactotronRedux } = require('reactotron-redux');
const reactotron = Reactotron.configure() // controls connection & communication settings
.useReactNative() // add all built-in react native plugins
.use(reactotronRedux())
.connect(); // let's connect!
export default reactotron;
Store.js
export const store = configureStore({
reducer: reducers,
middleware: [],
enhancers: __DEV__ ? [reactotron.createEnhancer!()] : [],
});
mocks/reactotron-react-native.js
const reactotron = {
configure: () => reactotron,
useReactNative: () => reactotron,
use: () => reactotron,
connect: () => reactotron,
clear: () => reactotron,
createEnhancer: () => reactotron,
};
export default reactotron;
Reactotron version
5.1.8