react-native icon indicating copy to clipboard operation
react-native copied to clipboard

TypeError: Cannot read property 'bind' of undefined

Open Tushar321321 opened this issue 3 years ago • 4 comments

Description

$ jest FAIL src/un-authorised/tests/signin.test.tsx ● Test suite failed to run

TypeError: Cannot read property 'bind' of undefined

  at Object.<anonymous> (node_modules/react-native/Libraries/Utilities/createPerformanceLogger.js:60:55)
  at Object.<anonymous> (node_modules/react-native/Libraries/ReactNative/AppRegistry.js:22:1)

FAIL src/un-authorised/tests/app.test.tsx ● Test suite failed to run

TypeError: Cannot read property 'bind' of undefined

  at Object.<anonymous> (node_modules/react-native/Libraries/Utilities/createPerformanceLogger.js:60:55)
  at Object.<anonymous> (node_modules/react-native/Libraries/ReactNative/AppRegistry.js:22:1)

Test Suites: 2 failed, 2 total Tests: 0 total Snapshots: 0 total Time: 3.742 s Ran all test suites. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Version

0.66.4

Output of npx react-native info

System: OS: macOS 12.1 CPU: (8) x64 Apple M1 Memory: 45.08 MB / 8.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.18.0 - /usr/local/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 7.24.0 - /opt/homebrew/bin/npm Watchman: 2021.11.15.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0 Android SDK: API Levels: 28, 29, 30 Build Tools: 19.1.0, 20.0.0, 28.0.1, 29.0.2, 30.0.0, 30.0.2, 30.0.3 System Images: android-31 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7784292 Xcode: 13.0/13A233 - /usr/bin/xcodebuild Languages: Java: 1.8.0_301 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.4 => 0.66.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

yarn test

Snack, code example, screenshot, or link to a repository

jest.config.js

module.exports = { preset: 'react-native', moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], moduleDirectories: ['node_modules', 'src'], modulePaths: ['<rootDir>'], testRegex: '(/tests/.|(\.|/)(test))\.tsx?$', setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], transformIgnorePatterns: [ '/node_modules/(?!(@react-native|reactotron-react-native|@react-native-async-storage|rn-tourguide|@react-native-community/netinfo|react-native-gesture-handler|static-container|react-native-fs|react-native))./', ], };

jest.setup.ts

import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock.js'; import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'; import {useDispatch, useSelector} from 'react-redux'; import 'react-native-gesture-handler';

jest.mock('react-native-fs', () => { const RNFS = { readFileAssets: async () => { return 'testdata'; }, };

return RNFS; });

jest.mock('@react-native-community/netinfo', () => mockRNCNetInfo);

jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);

package.json

{ "name": "DemoApp", "version": "0.0.1", "private": true, "scripts": { "android": "yarn android:dev:debug", "android:dev:debug": "react-native run-android --variant=devDebug --appIdSuffix=dev", "android-staging": "yarn android:staging:debug", "android:staging:debug": "react-native run-android --variant=stagingDebug --appIdSuffix=staging", "android-prod": "yarn android:prod:debug", "android:prod:debug": "react-native run-android --variant=prodDebug --appIdSuffix=prod", "ios": "yarn ios:dev:debug", "ios-dev": "react-native run-ios --scheme 'Dev' --configuration Dev", "start": "react-native start", "test": "jest", "lint": "eslint .", "codegen": "graphql-codegen --config codegen.yml", "test:build:android": "cd android && ./gradlew assembleDebug && cd ..", "test:run:android": "wdio wdio.conf.android.js", "test:build:ios": "xcodebuild -workspace DemoApp.xcworkspace -configuration Debug -scheme DemoApp -destination id=8CE32506-43C3-4737-8E61-775D43AD25B3", "test:run:ios": "wdio wdio.conf.ios.js" }, "dependencies": { "@apollo/react-hooks": "^4.0.0", "@react-native-async-storage/async-storage": "^1.15.14", "@react-native-community/clipboard": "^1.5.1", "@react-native-community/masked-view": "^0.1.11", "@react-native-community/netinfo": "^7.1.7", "@react-navigation/bottom-tabs": "^6.0.9", "@react-navigation/native": "^6.0.6", "@react-navigation/stack": "^6.0.11", "@reduxjs/toolkit": "^1.7.1", "apollo-client": "^2.6.10", "appium-doctor": "^1.16.0", "axios": "0.21.0", "axios-hooks": "^3.0.0", "email-validator": "^2.0.4", "google-libphonenumber": "^3.2.25", "graphql": "^16.2.0", "moment": "^2.29.1", "path-to-regexp": "^6.2.0", "react": "17.0.2", "react-native": "0.66.4", "react-native-bootsplash": "2.2.7", "react-native-confirmation-code-field": "^7.2.0", "react-native-device-info": "^8.4.8", "react-native-fast-image": "^8.5.11", "react-native-flags": "^1.0.0", "react-native-fs": "^2.18.0", "react-native-gesture-handler": "^2.2.0", "react-native-image-picker": "^4.6.0", "react-native-keyboard-aware-scrollview": "^2.1.0", "react-native-keychain": "^8.0.0", "react-native-linear-gradient": "^2.5.6", "react-native-markdown-package": "^1.8.1", "react-native-modal": "^13.0.0", "react-native-permissions": "^3.2.0", "react-native-reanimated": "^2.3.1", "react-native-safe-area-context": "^3.3.2", "react-native-safe-area-view": "^1.1.1", "react-native-screens": "^3.10.1", "react-native-shared-element": "^0.8.3", "react-native-svg": "^12.1.1", "react-native-svg-charts": "^5.4.0", "react-native-swiper": "^1.6.0", "react-native-tiny-toast": "^1.0.7", "react-native-vector-icons": "7.1.0", "react-native-webview": "^11.15.0", "react-navigation-shared-element": "^3.1.3", "react-number-format": "^4.9.0", "react-redux": "^7.2.6", "redux": "^4.1.2", "redux-mock-store": "^1.5.4", "redux-persist": "^6.0.0", "rn-fetch-blob": "^0.12.0", "rn-tourguide": "^3.2.0" }, "devDependencies": { "@babel/core": "^7.16.10", "@babel/runtime": "^7.12.5", "@graphql-codegen/cli": "2.3.0", "@graphql-codegen/introspection": "^2.1.0", "@graphql-codegen/typescript": "^2.4.1", "@graphql-codegen/typescript-operations": "^2.2.1", "@graphql-codegen/typescript-react-apollo": "^3.2.2", "@react-native-community/eslint-config": "^2.0.0", "@types/jest": "^27.0.3", "@types/react": "^17.0.38", "@types/react-native": "^0.66.10", "@types/react-test-renderer": "^17.0.1", "@wdio/appium-service": "^7.16.11", "@wdio/cli": "^7.16.13", "@wdio/jasmine-framework": "^7.16.11", "@wdio/local-runner": "^7.16.12", "@wdio/mocha-framework": "^7.16.11", "@wdio/spec-reporter": "^7.16.11", "babel-core": "^7.0.0-0", "babel-jest": "^27.4.6", "babel-plugin-module-resolver": "4.0.0", "eslint": "7.14.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.66.2", "react-test-renderer": "17.0.2", "reactotron-react-native": "^5.0.1", "reactotron-redux": "^3.1.3", "regenerator-runtime": "^0.13.9", "typescript": "^4.5.4" }, "jest": { "preset": "react-native", "setupFiles": [ "./node_modules/react-native-gesture-handler/jestSetup.js" ] } }

Tushar321321 avatar Jan 24 '22 09:01 Tushar321321

Hey, the same issue here. Any updates?

vladyslavNiemtsev avatar Feb 02 '22 18:02 vladyslavNiemtsev

Hey, the same issue here. Any updates?

not yet

Tushar321321 avatar Feb 03 '22 06:02 Tushar321321

@vladyslavNiemtsev @Tushar321321 Did either of you find workarounds for this error?

I am able to unblock myself by defining the global.nativeQPLTimestamp value in my jest.setup.js file

aplishka-pc avatar Apr 22 '22 16:04 aplishka-pc

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 20 '22 02:10 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Oct 28 '22 02:10 github-actions[bot]