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

fix component tests #15107

Closed
Parveshdhull opened this issue Feb 16, 2023 · 7 comments
Closed

fix component tests #15107

Parveshdhull opened this issue Feb 16, 2023 · 7 comments

Comments

@Parveshdhull
Copy link
Member

Summary

follow up from #15071 (comment)

few tests are failing with error: Cannot find module '@react-native-community/blur' from 'shadow.js.shim.module$$react_native_community$blur.js'

Guide for using ts-jest with react-native https://kulshekhar.github.io/ts-jest/docs/guides/react-native/

Troubleshooting addresses similar error: https://github.com/kulshekhar/ts-jest/blob/main/TROUBLESHOOTING.md

@Parveshdhull
Copy link
Member Author

Hi @yqrashawn, @J-Son89
Error is fixed in status-im/react-native-blur#1, but should we keep this issue open?
Because manually adding lib folder don't look like a robust solution

  • We need to keep it updated when we rebase with parent
  • I think lib folder is copied from npmjs, compiled lib don't inlcude manual changes made in forked version, so might break at some time

@J-Son89
Copy link
Contributor

J-Son89 commented Feb 17, 2023

hmm, what are some of the potential (long term) solutions for this? 🤔

@yqrashawn
Copy link
Contributor

The compiled lib is built from my local machine with the bob command

One simple solution is to use GitHub action to automatically publish patched package, for example https://github.com/marketplace/actions/npm-publish
This requires the package got patched to have proper prepare, prepublish or relevant hooks config or at least a build command
And we need a NPM token and need to manually config the repo to run actions (not by default in forked repo)

One thing I'm not sure about this is there might still be things that required to be compiled locally which requires to be triggered by yarn install.
react-native-status Node.js binding is one of this and that's why there's yanr install in make test(tried to call node-gyp directly with no luck)

Another one is we can just add yarn install to various affected make target, although this may slow things down and there's conflict when running multiple yarn install in parallel

@J-Son89
Copy link
Contributor

J-Son89 commented Feb 17, 2023

@yqrashawn, curious if you have ever seen/used this package? https://www.npmjs.com/package/patch-package

@yqrashawn
Copy link
Contributor

@yqrashawn, curious if you have ever seen/used this package? https://www.npmjs.com/package/patch-package

The lib folder is generated by bob build, so we still need to compile things after we apply the patch (I believe we don't want to have .min.js or .map in patch)

What's more, this package relies on hooks as well. So we need still need yarn install

@yqrashawn
Copy link
Contributor

diff --git a/src/status_im2/contexts/shell/bottom_tabs.cljs b/src/status_im2/contexts/shell/bottom_tabs.cljs
index fcbd24bb0..9da51459b 100644
--- a/src/status_im2/contexts/shell/bottom_tabs.cljs
+++ b/src/status_im2/contexts/shell/bottom_tabs.cljs
@@ -42,7 +42,7 @@
        (animation/load-stack @animation/selected-stack-id)
        (reanimated/set-shared-value (:pass-through? shared-values) pass-through?)
        [reanimated/view {:style animated-style}
-        (when pass-through?
+        (when true
           [blur/view (blur-overlay-params style/bottom-tabs-blur-overlay)])
         [rn/view {:style (style/bottom-tabs)}
          [bottom-tab :i/communities :communities-stack shared-values notifications-data]

run-clojure do work (no crash/error/warning, bottom tab renders, don't know if the blur view rendered correctly) with above change when there's no node_modules/@react-native-community/blur/lib
shadow-cljs release mobile no error as well

@cammellos
Copy link
Contributor

looks like this has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants