TypeError: Cannot read property 'OS' of undefined

See original GitHub issue

v3.0.0

While testing application with Jest throws an error:

TypeError: Cannot read property 'OS' of undefined
      
      at createIconSet (node_modules/react-native-vector-icons/lib/create-icon-set.js:26:25)
      at Object.<anonymous> (node_modules/react-native-vector-icons/FontAwesome.js:9:28)
...
import FontAwesome from 'react-native-vector-icons/FontAwesome';

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

10reactions
linhnh123commented, Jul 6, 2017

@iegik Try it

jest.mock('react-native', () => ({
  NativeModules: {
    RNPasscodeStatus: {
      supported: jest.fn(),
      status: jest.fn(),
      get: jest.fn(),
    }
  },
  StyleSheet: {
    create: () => ({})
  },
  Platform: {
    OS: jest.fn(() => 'android'),
    version: jest.fn(() => 25),
  },
}));
1reaction
FDiskascommented, Jan 30, 2020

does not works for me also 🎩 TypeError: Super expression must either be null or a function

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >
TypeError: Cannot read property 'OS' of undefined
v3.0.0. While testing application with Jest throws an error: TypeError: Cannot read property 'OS' of undefined at createIconSet ...
Read more >
TypeError: Cannot read properties of undefined (reading 'get')
OS, etc. I tried all the ways I found but none of them work, it seems like it doesn't detect the mocks for...
Read more >
cannot read properties of undefined (reading 'icon') - You.com
Here the error is coming from line 2: value: {Icon, name, level} . The value coming via props seems to be undefined. Check...
Read more >
Cannot read property 'platform' of undefined | by Walmyr Filho
Cannot read property 'platform' of undefined. Problem resolution with Visual Review and Protractor. For some time I was not working with Protractor integrated ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found