Cannot find module 'styled-jsx/style' in production firebase - javascript

I built a Next js app for which am trying to add some css.
Tried using the built in styled-jsx css lib . All works fine in local.
Now, when I upload the same in firebase hosting and try SSR using firebase functions . I get this error .
Question is : If styled jsx is part of next js then why am seeing this error . That too only in production
Using next js 6+ .
I know i can always add styled jsx as a dependency , but trying to understand why its not working since its supposed to be built in to next js already.
Thanks in Advance!
This is my package.json content :
"dependencies": {
"#babel/runtime": "^7.1.2",
"firebase": "^5.5.3",
"firebase-admin": "^5.12.1",
"firebase-functions": "^2.0.5",
"next": "^6.1.1",
"react": "^16.4.0",
"react-dom": "^16.4.0"
},
"devDependencies": {
"#babel/cli": "^7.1.2",
"#babel/core": "^7.1.2",
"#babel/preset-env": "^7.1.0",
"#firebase/app-types": "^0.3.2",
"cpx": "^1.5.0",
"firebase-tools": "^3.18.6",
"prettier": "^1.13.5",
"rimraf": "^2.6.2"
}
Error :
Error: Cannot find module 'styled-jsx/style'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:245:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:101:75)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.module.exports.Object.defineProperty.value (/user_code/next/server/bundles/pages/mystatus.js:89:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0) code: 'MODULE_NOT_FOUND', sourceMapsApplied:

Related

React Native iOS build release: RangeError: Maximum call stack size exceeded

I'm using react native 0.62.3 and everything worked ok yesterday.
After installing react-native-stripe-terminal package, I reverted everything, remove node_modules, Pods folders, reinstall and built to my iOS device with release scheme.
The app is installed but it crashed on the launch screen before Metro Bundle is loaded.
I tried to checkout the previous stable commit but same error.
I tried to build with release scheme in 3 mac devices but same error (debug mode is not happed anything).
Can anyone help me to know what happens with my project or have the same error or which package causes the issue? Thank you!
Here is my packages list:
"dependencies": {
"#dooboo-ui/native-switch-toggle": "^0.3.3",
"#react-native-async-storage/async-storage": "^1.15.5",
"#react-native-community/clipboard": "^1.2.2",
"#react-native-community/datetimepicker": "^2.1.0",
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/netinfo": "6.0.0",
"#react-native-community/push-notification-ios": "^1.8.0",
"#react-native-community/viewpager": "^4.0.1",
"#react-native-firebase/app": "^12.4.0",
"#react-native-firebase/auth": "^12.7.3",
"#react-native-firebase/crashlytics": "^12.4.0",
"#react-native-firebase/firestore": "^12.4.0",
"#react-native-firebase/messaging": "^12.4.0",
"#react-native-mapbox-gl/maps": "^8.2.1",
"appcenter": "4.0.0",
"appcenter-analytics": "4.0.0",
"appcenter-crashes": "4.0.0",
"axios": "^0.21.1",
"base-64": "^0.1.0",
"buffer": "^6.0.3",
"card-validator": "^6.2.0",
"dayjs": "^1.10.6",
"emoji-datasource": "^6.0.0",
"engine.io-client": "3.4.4",
"html-entities": "^1.3.1",
"lodash": "^4.17.15",
"lodash.compact": "^3.0.1",
"lodash.every": "^4.6.0",
"lodash.pick": "^4.4.0",
"lodash.values": "^4.3.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "16.11.0",
"react-native": "0.62.3",
"react-native-autoheight-webview": "^1.5.8",
"react-native-background-timer": "^2.4.0",
"react-native-big-calendar": "^0.1.32",
"react-native-calendar-picker": "^6.1.2",
"react-native-calendars": "^1.260.0",
"react-native-camera": "^4.0.0",
"react-native-cardview": "^2.0.5",
"react-native-code-push": "^7.0.4",
"react-native-device-info": "^8.1.3",
"react-native-document-picker": "^4.1.0",
"react-native-elements": "^1.2.1",
"react-native-fast-image": "^8.3.4",
"react-native-file-viewer": "^2.0.0",
"react-native-fontawesome": "^5.7.0",
"react-native-fs": "2.15.2",
"react-native-geolocation-service": "^5.3.0-beta.3",
"react-native-gesture-handler": "^1.4.1",
"react-native-gps-state": "^2.0.3",
"react-native-highlight-words": "^1.0.1",
"react-native-hyperlink": "^0.0.19",
"react-native-i18n": "^2.0.15",
"react-native-image-crop-picker": "^0.25.3",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-picker": "^1.1.0",
"react-native-intercom": "13.2.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-media-controls": "^2.2.0",
"react-native-mixpanel": "^1.2.5",
"react-native-modal": "^11.5.6",
"react-native-modalbox": "^2.0.2",
"react-native-orientation-locker": "^1.3.1",
"react-native-permissions": "^2.1.1",
"react-native-popup-menu": "^0.15.9",
"react-native-progress": "^5.0.0",
"react-native-push-notification": "^7.4.0",
"react-native-qrcode-scanner": "^1.5.4",
"react-native-raw-bottom-sheet": "^2.0.2",
"react-native-reanimated": "^1.4.0",
"react-native-responsive-screen": "^1.2.2",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^2.8.0",
"react-native-signature-capture": "^0.4.10",
"react-native-signature-pad": "^0.1.0",
"react-native-slider": "^0.11.0",
"react-native-splash-screen": "^3.2.0",
"react-native-square-in-app-payments": "^1.5.0",
"react-native-svg": "^9.13.3",
"react-native-svg-transformer": "^0.14.2",
"react-native-swipe-list-view": "^3.1.0",
"react-native-vector-icons": "^7.1.0",
"react-native-video": "^5.1.1",
"react-native-view-overflow": "0.0.4",
"react-native-webview": "11.4.4",
"react-navigation": "^3.12.1",
"react-navigation-animated-switch": "^0.4.1",
"react-redux": "^7.1.1",
"reanimated-bottom-sheet": "^1.0.0-alpha.20",
"redux": "^4.0.4",
"redux-saga": "^1.1.3",
"socket.io-client": "2.4.0",
"tipsi-stripe": "^7.5.3"
},
"devDependencies": {
"#babel/core": "7.6.2",
"#babel/runtime": "7.6.2",
"#react-native-community/eslint-config": "0.0.3",
"babel-jest": "^24.9.0",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.10.1",
"eslint-config-standard": "^14.1.1",
"eslint-import-resolver-babel-module": "^5.1.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^4.0.4",
"eslint-plugin-react-native": "^3.8.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^24.9.0",
"jetifier": "^1.6.4",
"metro-react-native-babel-preset": "^0.58.0",
"prettier": "^2.0.4",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./path/to/jestSetupFile.js"
]
}
Xcode console show this
objc[35818]: Class MGLFaux3DUserLocationAnnotationView is implemented in both /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/Frameworks/Mapbox.framework/Mapbox (0x109927f90) and /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/MyApp (0x103aa7068). One of the two will be used. Which one is undefined.
objc[35818]: Class MGLUserLocationHeadingArrowLayer is implemented in both /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/Frameworks/Mapbox.framework/Mapbox (0x109928620) and /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/MyApp (0x103aa71a8). One of the two will be used. Which one is undefined.
objc[35818]: Class MGLUserLocationHeadingBeamLayer is implemented in both /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/Frameworks/Mapbox.framework/Mapbox (0x109929520) and /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/MyApp (0x103aa71f8). One of the two will be used. Which one is undefined.
2021-12-17 14:08:04.728837+0700 MyApp[35818:1435990] 8.0.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more.
2021-12-17 14:08:04.729565+0700 MyApp[35818:1435808] [Firebase/Crashlytics] Version 8.0.0
2021-12-17 14:08:04.913803+0700 MyApp[35818:1435808] [AppCenterCrashes] WARNING: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/731 Detecting crashes is NOT enabled due to running the app with a debugger attached.
2021-12-17 14:08:04.933688+0700 MyApp[35818:1435808]
[CodePush] Loading JS bundle from file:///private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/main.jsbundle
2021-12-17 14:08:05.148221+0700 MyApp[35818:1436001] 8.0.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
firebase/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2021-12-17 14:08:05.149318+0700 MyApp[35818:1436001] 8.0.0 - [Firebase/Messaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '126625914542'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.
2021-12-17 14:08:05.175 [error][tid:com.facebook.react.JavaScript] RangeError: Maximum call stack size exceeded.
2021-12-17 14:08:05.178 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2021-12-17 14:08:05.188 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: RangeError: Maximum call stack size exceeded.
2021-12-17 14:08:05.189107+0700 MyApp[35818:1435997] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: RangeError: Maximum call stack size exceeded.', reason: 'Unhandled JS Exception: RangeError: Maximum call stack size exceeded., stack:
<unknown>#(null):(null)
v#2:1267
<unknown>#454.js:1:101
v#2:1473
<unknown>#453.js:1:127
v#2:1473
<unknown>#439.js:1:140
v#2:1473
<unknown>#405.js:1:650
v#2:1473
<unknown>#1.js:1:57
v#2:1473
d#2:875
global code#7:3
'
*** First throw call stack:
(0x181cf5c9c 0x198ea9758 0x102f365ec 0x102fb0bd0 0x102fb14f8 0x181c848d0 0x181ca05a8 0x181cd480c 0x102f650d4 0x102f67280 0x102f66ff0 0x1050e0718 0x1050e1f94 0x1050e9150 0x1050e9dd4 0x1050f54e8 0x1dbcc1e84 0x1dbcc19f0)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: RangeError: Maximum call stack size exceeded.', reason: 'Unhandled JS Exception: RangeError: Maximum call stack size exceeded., stack:
<unknown>#(null):(null)
v#2:1267
<unknown>#454.js:1:101
v#2:1473
<unknown>#453.js:1:127
v#2:1473
<unknown>#439.js:1:140
v#2:1473
<unknown>#405.js:1:650
v#2:1473
<unknown>#1.js:1:57
v#2:1473
d#2:875
global code#7:3
'
terminating with uncaught exception of type NSException
(lldb)
Screenshot
I can't guarantee that this will solve your problem, but it might help.
Because you deleted everything, you may need to reinstall your packages.
To do that, try the following:
in your terminal, in the root of your project, run
npm i or yarn. Then
cd ios
pod install.
Then open the xcworkspace in XCode and press Command-Shift-K to do a full clean.
You can then run your iOS build task again and see if it works.
I have started to get this issue right after installing "#react-native-async-storage/async-storage" and I see thet you have this packeg also

Converting Js to Ts error cannot find module

Currently converting my project from JS to TS, working on the server side. Here is the error code.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module
'/Users/steven/Documents/codingDojo/Mern/tomrotten/server/index.js'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
[nodemon] app crashed - waiting for file changes before starting...
here are a list of my dependencies:
"dependencies": {
"#material-ui/lab": "^4.0.0-alpha.58",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-session": "^1.17.1",
"jsonwebtoken": "^8.5.1",
"mysql": "^2.18.1",
"mysql2": "^2.2.5",
"sequelize": "^6.5.0",
"sqlite3": "^5.0.1"
This happens because it is missing a dependency, either because the dependency is not imported, or it is but it isn't installed. Do you have import cjr from "cjr" or something like that at the top of server/index.js? Have you done npm install?

bundling failed: Error: Cannot find module 'babel-preset-react-native' from '/workspace/reactnative''

I updated react-native to v0.57 and react-native run-ios is failing. I replaced babel-preset-react-native with metro-react-native-babel-preset as suggested in https://www.npmjs.com/package/babel-preset-react-native. here is the error stack trace I am getting.
error: bundling failed: Error: Cannot find module 'babel-preset-react-native' from '/Users/buraktas/workspace/reactnative'
- If you want to resolve "react-native", use "module:react-native"
at Function.module.exports [as sync] (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/node_modules/resolve/lib/sync.js:58:15)
at resolveStandardizedName (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/config-descriptors.js:154:9)
at items.map (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/buraktas/workspace/reactnative/node_modules/#babel/core/lib/config/config-descriptors.js:101:10)
package.json
{
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"rnpm": {
"assets": [
"./assets/fonts/"
]
},
"dependencies": {
"axios": "^0.17.1",
"moment": "^2.20.1",
"moment-timezone": "^0.5.14",
"react": "16.2.0",
"react-native": "^0.57.8",
"react-native-branch": "^2.3.0",
"react-native-camera": "^1.0.0",
"react-native-datepicker": "^1.6.0",
"react-native-deep-linking": "^2.1.0",
"react-native-fabric": "^0.5.1",
"react-native-keyboard-aware-scroll-view": "^0.4.3",
"react-native-modal": "^4.1.1",
"react-navigation": "^1.0.0-beta.22",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-form": "^7.1.2",
"redux-saga": "^0.16.0",
"stripe-client": "^1.1.3"
},
"devDependencies": {
"#babel/core": "^7.0.0",
"#babel/preset-flow": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.4.2",
"babel-preset-airbnb": "^3.2.0",
"detox": "^9.0.4",
"eslint": "^5.12.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.12.3",
"eslint-plugin-react-native": "^3.6.0",
"jest-cli": "^23.6.0",
"metro-react-native-babel-preset": "^0.51.1",
"react-test-renderer": "16.0.0",
"remote-redux-devtools": "^0.5.12"
},
"jest": {
"preset": "react-native"
}
}
.babelrc
{
"presets": [
"airbnb",
"#babel/preset-env",
"module:react-native",
"module:metro-react-native-babel-preset"
]
}
Deleting .babelrc file will fix this for you.
Please check react native upgrade helper
https://react-native-community.github.io/upgrade-helper
and specify your current React native version and the version to update (0.57 in your case)
You will see changes need to do in your case to make the code compatible with updated version
Looking at your package.json it looks like all you have done is upgrade the version of react-native to the latest version.
Unfortunately it is not as simple as changing the version number in the package.json. You don't state which version of react-native you were using before, but as you are using React 16.2.0 I would hazard a guess that you were on react-native 0.52 or 0.53.
To upgrade you should look at the diff that is provided between your version and the version that you upgrading to. rn-diff-purge shows the changes between that need to be performed. For upgrading 0.52.0 to 0.57.8 you can see the changes here, for 0.53.0 to 0.57.8 you can see the changes here.
You can check the changelog https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md to see more specific requirements for upgrading between the versions.
It is also worthwhile looking at https://facebook.github.io/react-native/docs/upgrading for tips on how to perform an upgrade.

Unable to resolve module 'expo-font.js'

I'm working with expo and snack and keep getting this error
Unable to resolve module 'module://expo-font.js' Evaluating module://expo-font.js Evaluating module://react-native-elements.js
...
I'm not importing any fonts and by tracing the path above, can see that it faults in the 'react-native-elements' module
Here are the dependencies in package.json
"react-native-elements": "0.19.1",
"react-navigation": "1.0.0-beta.27",
"react-native-animatable": "1.3.0",
"react-redux": "5.0.7",
"redux": "4.0.0",
"redux-logger": "3.0.6",
"redux-persist": "5.10.0",
"redux-persist/lib/storage": "5.10.0"
I also do not have access to the App.json file on snack until export
In the past changing the react-native-elements version to something lower hacked it but that doesn't seem to do the job anymore
I solved it by importing "expo-font"
In the Expo interface, I updated package.json I did this and it works.The key is to add "expo-font":"^1.0.0". Behind the scenes it resolves to expo-font#1.1.0.
"dependencies": {
"#babel/core": "^7.0.0",
"react-native-elements": "^1.0.0-beta7",
"expo-font": "^1.0.0",
"expo-asset": "~1.1.1",
"expo-file-system": "~1.1.0",
"expo-constants": "~1.1.0"
}

jest-resolve nested module resolving wrong path: Cannot find module 'react-dnd' from 'reactTags.js'

I have a module I am trying to test. That module is using other external modules and jest is having a hard time resolving them.
It is resolving the base path to:
./node_modules/react-tag-input/dist-modules/
Instead of:
./node_modules/react-tag-input/node_modules/react-dnd
Below, is a simplified version of what is happening:
Error:
Cannot find module 'react-dnd' from 'reactTags.js'
at Resolver.resolveModule (node_modules/jest-cli/node_modules/jest-resolve/build/index.js:160:17)
at Object.<anonymous> (node_modules/react-tag-input/dist-modules/reactTags.js:13:17)
at Object.<anonymous> (src/tagger/eventtagger.js:5:404)
This is my test file:
caseevent.test.js
import EventTagger from './eventtagger.js';
eventtagger.js
import ReactTags from 'react-tag-input';
package.json
"jest": {
"moduleFileExtensions": [
"js",
"jsx"
],
"modulePaths": [
"<rootDir>"
],
},
"dependencies": {
"babel-jest": "^17.0.2",
"flux": "^2.0.1",
"install": "^0.8.1",
"jest": "^17.0.3",
"lodash.flow": "^3.3.0",
"npm": "^3.10.6",
"object-assign": "^1.0.0",
"react": "^15.4.0",
"react-dnd": "git+https://github.com/jcrogel/react-dnd.git",
"react-dnd-html5-backend": "^2.0.0",
"react-dom": "^15.4.0",
"react-tag-input": "^4.4.0",
"react-tagcloud": "^0.6.1"
},
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-core": "^6.14.0",
"babel-eslint": "^4.1.3",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.0.15",
"babel-preset-react": "^6.0.15",
"babel-preset-stage-0": "^6.0.15",
"babel-register": "^6.9.0",
"chai": "^3.5.0",
"enzyme": "^2.6.0",
"jest-cli": "^17.0.3",
"jsdom": "^9.4.0",
"lodash": "4.14.1",
"react-addons-test-utils": "^15.4.0",
"react-native": "^0.38.0",
"react-test-renderer": "15.4.0",
"sinon": "^1.17.4",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"whatwg-fetch": "^2.0.1"
}
What am I missing? How do I get jest-resolve to find or mock deeper components?
I'm having the same issue as well. Some things I've attempted:
jest.unmock(module) at the top of the testing file
polyfill the module in a Jest setup file
jest.mock(jest.fn() => {console.log('do something'))
Lastly, and this seemed to work, but I can't find documentation on this:
At the top of the testing file:
/**
* #providesModule moduleName
*/
This seems to recognize the module I needed. Jest is supposed to implicitly see modules out of the box, but I haven't had that experience with it.
I had a similar problem in my jest tests, with an external dependency of webpack.
To solve that:
I create a __mocks__ folder in the same level if __test__ folder.
Inside that, I created a file with the same name of the dependency, in my case it was jquery ($.js).
Inside my test file, I use jest.mock function to reference the mock external dependency: jest.mock('$');
from jest the docs:
https://facebook.github.io/jest/docs/manual-mocks.html
Hope it could help.

Categories

Resources