當我嘗試使用笑話測試我的反應本機應用程序時,出現奇怪的導入錯誤。我有babel-jest,babel-preset-react-native,jest,jest-react-native和react-test-render都安裝了,但是當我運行npm測試時得到這個錯誤信息。意外的導入令牌 - 測試React Native與Jest
●測試套件運行失敗
/Users/maftalion/www/stars20/kiosk/node_modules/native-base/index.js:4
import Drawer from './Components/vendor/react-native-drawer';
^^^^^^
**SyntaxError: Unexpected token import**
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:316:10)
at Object.<anonymous> (src/routes/Identification.js:3:17)
at Object.<anonymous> (src/routes/router.js:4:21)
測試套件:1失敗,1過去了,2個總 測試:1後,1總 花絮:1後,1周總 時間:1.011s
有關此解決方法的更多上下文:https://github.com/GeekyAnts/NativeBase/issues/396#issuecomment -270116326 – dadads