lazaronixon / react-native-qrcode-reader

251 stars 77 forks source link

TypeError: Cannot read property 'Aspect' of undefined #8

Open ashokseervidev opened 7 years ago

ashokseervidev commented 7 years ago

I am writing unit test cases for my project using jest.

when i run npm test i am getting below error.

● Test suite failed to run

    TypeError: Cannot read property 'Aspect' of undefined

      at Object.<anonymous> (node_modules/react-native-qrcode-scanner/node_modules/react-native-camera/index.js:254:78)
      at Object.<anonymous> (node_modules/react-native-qrcode-scanner/index.js:17:24)

below is my code.

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import {Item} from '../Item';

test('works', () => {
  expect(true).toBe(true)
})

react-native --version react-native-cli: 2.0.1 react-native: 0.40.0

package.json "react-native-qrcode-scanner": "0.0.8",

rijn commented 6 years ago

The link of react-native-camera is incorrect.

imranMnts commented 6 years ago

Add this jest.mock('react-native-qrcode-scanner', () => jest.fn());