2017-08-31 92 views
1

您好我一直在嘗試運行'npm測試'面對一些類似於本機的問題,但通過將'native- base-shoutem-theme ||| tcomb-form-native'在我的Package.json文件中的transformIgnorePatterns項中。Jest testing ::測試失敗和錯誤路由到 react-native-vector-icons

,但沒有發現與反應原生向量-圖標的溶液如下所示

[email protected] test D:\ReactWorkSpace\myapp 
jest 
PASS tests\index.ios.js 
FAIL tests\index.android.js 
● Test suite failed to run 
D:\ReactWorkSpace\myapp\node_modules\native-base\node_modules\react-native-vector-icons\Ionicons.js:6 
import createIconSet from './lib/create-icon-set'; 
^^^^^^ 
SyntaxError: Unexpected token import 
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17) 
at Object.<anonymous> (node_modules/native-base/dist/src/basic/IconNB.js:5:15) 
at Object.<anonymous> (node_modules/native-base/dist/src/index.js:16:13) 
Test Suites: 1 failed, 1 passed, 2 total 
Tests: 1 passed, 1 total 
Snapshots: 0 total 
Time: 3.189s, estimated 8s 
Ran all test suites. 
npm ERR! Test failed. See above for more details 

我的package.json文件是

{ 
"name": "myapp", 
"version": "0.0.1", 
"private": true, 
"scripts": { 
"start": "node node_modules/react-native/local-cli/cli.js start", 
"test": "jest" 
}, 
"dependencies": { 
"js-base64": "^2.1.9", 
"moment": "^2.18.1", 
"native-base": "^2.2.1", 
"react": "16.0.0-alpha.12", 
"react-native": "0.46.0", 
"react-native-animatable": "^1.2.2", 
"react-native-button": "^2.0.0", 
"react-native-drawer": "^2.3.0", 
"react-native-linear-gradient": "^2.2.0", 
"react-native-material-design": "^0.3.7", 
"react-native-material-kit": "^0.4.1", 
"react-native-material-ui": "^1.12.0", 
"react-native-vector-icons": "^4.2.0", 
"react-navigation": "^1.0.0-beta.11", 
"react-toolbox": "^2.0.0-beta.12", 
"render-if": "^0.1.1" 
}, 
"devDependencies": { 
"babel-jest": "20.0.3", 
"babel-preset-react-native": "2.1.0", 
"jest": "^20.0.4", 
"react-test-renderer": "16.0.0-alpha.12" 
}, 
"jest": { 
"preset": "react-native", 
"transformIgnorePatterns": [ 
    "node_modules/(?!react-native|native-base-shoutem-theme|@shoutem/animation|@shoutem/ui|tcomb-form-native)" 
] 
} 
} 
+0

同樣的問題,你有沒有找到解決方案? –

+0

沒有運氣兄弟,請找到這個線程,如果找到謝謝 –

回答

0

//package.json 它解決你的問題:)

"jest": { 
     "preset": "react-native", 
     "transformIgnorePatterns": [ 
      "/node_modules/(?!native-base)/" 
     ], 

     ......... 
     } 
相關問題