infinitered / infinitered/reactotron

Using Reactotron while running detox tests

Open
#1,220 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15.6k
Forks
972
PR merge metrics
No merged PRs in 30d

Description

I'd like to use Reactotron while running detox tests but getting the following error:

> import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';
> ^^^^^^
> SyntaxError: Cannot use import statement outside a module
> 1 | import AsyncStorage from '@react-native-async-storage/async-storage';
> 2 | import Reactotron from 'reactotron-react-native';
> | ^
> 3 | import { reactotronRedux as reduxPlugin } from 'reactotron-redux';
> 4 | import sagaPlugin from 'reactotron-redux-saga';

How can I get rid of this error and use Reactotron?

package.json:

```json
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base)"
],
"setupFilesAfterEnv": [
"/__mocks__/globalMock.js"
]
},
```

"react-native": "0.63.3",
"reactotron-react-native": "^5.0.0",
"reactotron-redux": "^3.1.3",
"reactotron-redux-saga": "^4.2.3",

Contributor guide

Open the contributing guide

Research direction

Start with the package.json Jest configuration, especially the react-native preset and transformIgnorePatterns, and reproduce the Detox test error with the listed React Native and Reactotron versions. Determine which configuration change allows Reactotron imports during Detox tests; done means the tests run without the module syntax error while Reactotron remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
mobile-dev, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.