Fortpflanzen:
Ergebnis:
FAIL- Tests /Intro-test.js (0,459s)
● Intro › es wird richtig gerendert
- TypeError: Eigenschaft '_tag' von undefined kann nicht gelesen werden
bei ReactNativeBaseComponent.Mixin.mountComponent (node_modules/react/lib/ReactNativeBaseComponent.js:179:45)
at Object.ReactReconciler.mountComponent (node_modules/react/lib/ReactReconciler.js:47:35)
at ReactCompositeComponentMixin.performInitialMount (node_modules/react/lib/ReactCompositeComponent.js:397:34)
bei ReactCompositeComponentMixin.mountComponent (node_modules/react/lib/ReactCompositeComponent.js:262:21)
at Object.ReactReconciler.mountComponent (node_modules/react/lib/ReactReconciler.js:47:35)
at ReactCompositeComponentMixin.performInitialMount (node_modules/react/lib/ReactCompositeComponent.js:397:34)
bei ReactCompositeComponentMixin.mountComponent (node_modules/react/lib/ReactCompositeComponent.js:262:21)
at Object.ReactReconciler.mountComponent (node_modules/react/lib/ReactReconciler.js:47:35)
bei ReactMultiChild.Mixin.mountChildren (node_modules/react/lib/ReactMultiChild.js:242:44)
at ReactTestComponent.mountComponent (node_modules/react/lib/ReactTestRenderer.js:53:8)
Per https://facebook.github.io/jest/docs/tutorial-react-native.html#mock -native-modules-using-jest-mock besteht die Problemumgehung darin, hinzuzufügen
jest.mock('TextInput', () => 'TextInput');
zum Anfang Ihres Tests.
Wir sollten einen Standardmock für TextInput bereitstellen.
Behoben in https://github.com/facebook/jest/pull/1516 für Jest 15.
Hilfreichster Kommentar
Per https://facebook.github.io/jest/docs/tutorial-react-native.html#mock -native-modules-using-jest-mock besteht die Problemumgehung darin, hinzuzufügen
jest.mock('TextInput', () => 'TextInput');
zum Anfang Ihres Tests.