2017-10-03 13 views
1

でのテスト中:enter image description hereエラー/反応し、ネイティブ/ライブラリ/モーダル/ Modal.js私は冗談で、簡単なスナップショットのテストを行うと、ちょうどこのエラーが出るよ冗談

home.test.jsを

import React from 'react'; 
import Home from './index'; 
import renderer from 'react-test-renderer'; 

it('renders home',()=> { 
    const view = renderer.create(
    <Home></Home> 
).toJSON(); 
    expect(view).toMatchSnapshot(); 
}); 

残念ながら、ここでは何が問題なのかわかりません。私はテストがうまく書かれていると思った。

助けがあれば助かります。私は削除されている私は

を実行したMY TESTを維持ERRORを解決しHOW

答えて

1

は、欲求不満の多くの時間後

Error Page

を実行しているから、私のテストを守っている、このエラーに遭遇しましたnode_modulesフォルダーを2回再インストールして、何も解決せずにStackoverflowとGoogleで精査したところ、私は新しいCRNAプロジェクトを作成し、同じ問題があるかどうかを判断しました。 私は問題は新しいレポに存在しませんでした見たとき、私はそれを動作させるためには、次の手順を使用:

  1. キーと私のpackage.jsonファイルを、アップグレード
  2. 再びnode_modulesフォルダを削除変更は、以下に示す:

` {

"devDependencies": { 
     "react-native-scripts": "1.5.0", 
     "jest-expo": "^21.0.2", 
     "react-test-renderer": "16.0.0-alpha.12" 
    }, 


"jest": { 
     "preset": "jest-expo", 
     "transformIgnorePatterns": [ 
       "node_modules/(?!react-native|expo|react-navigation|native-base-shoutem-theme|@shoutem/theme|@shoutem/animation|@shoutem/ui|tcomb-form-native)" 
     ] 
    }, 


"dependencies": { 
       "react-native": “0.48.4”, 
     "expo": "^21.0.2", 
     "react": "16.0.0-alpha.12" 
    }, 

3. The core difference was in upgrading react-native from 0.48.0 to 0.48.4; react-native-scripts from 1.2.1 to 1.5.0 and including the transformIgnorePatterns under the jest option. NOTE: The portion from *native-base* in the transformIgnorePatterns was included because I used NativeBase in the project. 4. I then added a .babelrc with the following details:

{ 
     "presets": ["babel-preset-expo"], 
     "env": { 
       "development": { 
        "plugins": ["transform-react-jsx-source"] 
      } 
     } 
    } 

`` ` 5.テストを実行しても、今私に結果を与える:すべてのテストが

+0

何のcRNA手段緑のあるPassing Tests

を? –

+0

CRNA:create-react-native-app。 – icukaegbu

関連する問題