Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error running yarn reassure - Object.defineProperty called on non-object #413

Open
brandon-gs opened this issue Aug 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@brandon-gs
Copy link

brandon-gs commented Aug 16, 2023

BUG

Every time I run the yarn reassure I get this error on my test

FAIL tests/Text.perf-test.tsx
● Test suite failed to run

TypeError: Object.defineProperty called on non-object
    at Function.defineProperty (<anonymous>)

  at Object.<anonymous>.createComplexClass.isClass (node_modules/mathjs/lib/cjs/type/complex/Complex.js:19:10)
  at assertAndCreate (node_modules/mathjs/lib/cjs/utils/factory.js:46:12)
  at Object.<anonymous> (node_modules/mathjs/lib/cjs/entry/pureFunctionsAny.generated.js:20:67)
  at Object.<anonymous> (node_modules/mathjs/lib/cjs/entry/mainAny.js:51:34)

Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.342 s
Ran all test suites.

- I have some test written using jest and @testing-library/react-native and their work well

- This are the packages on my package.json

"dependencies": {
    "@expo-google-fonts/montserrat": "^0.1.0",
    "@gorhom/bottom-sheet": "^4.1.0",
    "@hookform/resolvers": "^2.8.1",
    "@invertase/react-native-apple-authentication": "^2.2.2",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-community/image-editor": "^2.3.0",
    "@react-native-cookies/cookies": "^6.2.1",
    "@react-native-firebase/analytics": "^18.1.0",
    "@react-native-firebase/app": "^18.1.0",
    "@react-native-firebase/in-app-messaging": "^18.1.0",
    "@react-native-firebase/messaging": "^18.1.0",
    "@react-native-masked-view/masked-view": "0.2.6",
    "@react-navigation/bottom-tabs": "^6.5.3",
    "@react-navigation/core": "^6.4.6",
    "@react-navigation/devtools": "^6.0.2",
    "@react-navigation/drawer": "^6.1.6",
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/stack": "^6.3.11",
    "@ricardo-alan/react-native-avatar-crop": "^1.3.7",
    "@sentry/integrations": "^6.19.2",
    "@sentry/react-native": "4.1.0",
    "@shopify/flash-list": "^1.0.4",
    "@shopify/react-native-performance": "^4.1.2",
    "@shopify/react-native-performance-lists-profiler": "^1.1.0",
    "@shopify/react-native-performance-navigation": "^3.0.0",
    "@shopify/react-native-performance-navigation-bottom-tabs": "^3.0.0",
    "@shopify/react-native-performance-navigation-drawer": "^3.0.0",
    "@shopify/restyle": "^2.4.1",
    "@types/color": "^3.0.1",
    "axios": "0.21.0",
    "color": "^3.1.3",
    "expo": "^45.0.0",
    "expo-application": "~4.1.0",
    "expo-auth-session": "~3.6.1",
    "expo-camera": "~12.2.0",
    "expo-constants": "~13.1.1",
    "expo-device": "~4.2.0",
    "expo-google-sign-in": "~10.2.0",
    "expo-image-manipulator": "~10.3.1",
    "expo-linear-gradient": "~11.3.0",
    "expo-random": "~12.2.0",
    "expo-secure-store": "~11.2.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-tracking-transparency": "~2.2.0",
    "expo-updates": "~0.13.4",
    "expo-web-browser": "~10.2.1",
    "i18next": "^19.8.4",
    "intl": "^1.2.5",
    "jest": "^26.6.3",
    "jwt-decode": "^3.1.2",
    "lodash": "^4.17.20",
    "lottie-ios": "3.2.3",
    "lottie-react-native": "5.1.3",
    "luxon": "^2.2.0",
    "react": "17.0.2",
    "react-countdown": "^2.3.1",
    "react-dom": "17.0.2",
    "react-error-boundary": "^3.1.3",
    "react-hook-form": "^7.15.4",
    "react-i18next": "^11.8.5",
    "react-native": "0.68.5",
    "react-native-code-push": "^7.0.5",
    "react-native-collapsible": "^1.5.3",
    "react-native-device-info": "^8.7.0",
    "react-native-document-picker": "^8.1.3",
    "react-native-dotenv": "^2.4.3",
    "react-native-fast-image": "^8.5.11",
    "react-native-fbsdk-next": "^11.2.1",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-image-picker": "^4.7.1",
    "react-native-image-size": "^1.1.3",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-in-app-review": "^4.1.1",
    "react-native-jumio-mobilesdk": "https://github.com/Jumio/mobile-react.git#v4.4.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-markdown-display": "^6.1.6",
    "react-native-mmkv": "^2.3.0",
    "react-native-paper": "^4.8.1",
    "react-native-paper-dropdown": "^1.0.7",
    "react-native-play-install-referrer": "^1.1.8",
    "react-native-print": "^0.10.0",
    "react-native-reanimated": "~2.8.0",
    "react-native-reanimated-carousel": "^3.1.5",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "^3.18.2",
    "react-native-skeleton-content-nonexpo": "^1.0.13",
    "react-native-svg": "12.3.0",
    "react-native-switch": "^1.5.1",
    "react-native-text-input-mask": "^3.1.4",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-web": "0.17.7",
    "react-native-web-lottie": "^1.4.4",
    "react-native-webview": "11.18.1",
    "react-native-youtube-iframe": "^2.2.2",
    "react-native-zxcvbn": "^1.0.1",
    "react-navigation-collapsible": "^6.3.0",
    "react-query": "^3.12.0",
    "reassure": "^0.9.0",
    "sentry-expo": "4.1.0",
    "sp-react-native-in-app-updates": "^1.1.7",
    "yup": "^0.32.9",
    "zustand": "^4.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@commitlint/cli": "^11.0.0",
    "@commitlint/config-conventional": "^11.0.0",
    "@expo/webpack-config": "~0.16.21",
    "@ls-lint/ls-lint": "^1.9.2",
    "@react-native-community/eslint-config": "^3.0.0",
    "@storybook/addon-actions": "^6.5.9",
    "@storybook/addon-docs": "^6.5.9",
    "@storybook/addon-essentials": "^6.5.9",
    "@storybook/addon-interactions": "^6.5.9",
    "@storybook/addon-knobs": "^6.3",
    "@storybook/addon-links": "^6.5.9",
    "@storybook/addon-viewport": "^6.5.9",
    "@storybook/jest": "^0.0.10",
    "@storybook/react": "^6.5.9",
    "@storybook/testing-library": "^0.0.6",
    "@testing-library/jest-native": "^3.4.3",
    "@testing-library/react-hooks": "^7.0.2",
    "@testing-library/react-native": "^12.2.2",
    "@tsconfig/react-native": "^1.0.2",
    "@types/jest": "^26.0.19",
    "@types/jest-json-schema": "^2.1.3",
    "@types/lodash": "^4.14.168",
    "@types/luxon": "^2.0.9",
    "@types/react": "~17.0.21",
    "@types/react-dom": "~17.0.11",
    "@types/react-native": "~0.67.6",
    "@types/react-native-vector-icons": "^6.4.6",
    "@types/zxcvbn": "^4.4.1",
    "babel-loader": "^8.2.2",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-preset-expo": "~9.1.0",
    "conventional-changelog-cli": "^2.1.1",
    "dotenv": "^8.2.0",
    "eslint": "^7.15.0",
    "eslint-plugin-typescript-sort-keys": "^1.7.0",
    "husky": "^4.3.6",
    "jest-expo": "^47.0.1",
    "jest-json-schema": "^2.1.0",
    "lint-staged": "^10.5.3",
    "miragejs": "0.1.42",
    "patch-package": "^6.5.1",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "^2.2.1",
    "react-native-flipper": "0.162.0",
    "react-native-version": "^4.0.0",
    "react-native-web-webview": "^1.0.2",
    "react-query-native-devtools": "^3.0.1",
    "react-test-renderer": "^17",
    "require-environment-variables": "^1.2.0",
    "storybook-addon-designs": "^6.3.1",
    "storybook-dark-mode": "^3.0.0",
    "storybook-mirage": "^0.1.0",
    "tsconfig-paths-webpack-plugin": "^3.5.1",
    "typescript": "~4.3.5",
    "xmlhttprequest": "^1.8.0"
  },
  "resolutions": {
    "@types/react": "17.0.2",
    "@types/react-dom": "17.0.2"
  },

- My test file

import { Text } from 'react-native';
import { measurePerformance } from 'reassure'; // Import the library is the problem

test('Text', async () => {
  await measurePerformance(<Text>Hello world</Text>, {});
});```
@brandon-gs brandon-gs added the bug Something isn't working label Aug 16, 2023
@brandon-gs brandon-gs changed the title Error running yarn reassure Error running yarn reassure - Object.defineProperty called on non-object Aug 17, 2023
@brandon-gs brandon-gs changed the title Error running yarn reassure - Object.defineProperty called on non-object [BUG] Error running yarn reassure - Object.defineProperty called on non-object Aug 17, 2023
@mdjastrzebski
Copy link
Member

@brandon-gs could you post a minimal reproduction repo so that I can investigate the issue?

@brandon-gs
Copy link
Author

@mdjastrzebski

I solved it updating "moduleDirectories" in my jest.config.json

Before:
"moduleDirectories": ["node_modules", "utils"],

After:
"moduleDirectories": ["<rootDir>/node_modules", "<rootDir>/utils"],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants