bartonhammond / snowflake

:snowflake: A React-Native Android iOS Starter App/ BoilerPlate / Example with Redux, RN Router, & Jest with the Snowflake Hapi Server running locally or on RedHat OpenShift for the backend, or a Parse Server running locally or remotely on Heroku
http://bartonhammond.github.io/snowflake/snowflake.js.html
MIT License
4.59k stars 614 forks source link

Update project to RN 0.41.2 for iOS project. #184

Closed siemiatj closed 7 years ago

siemiatj commented 7 years ago
siemiatj commented 7 years ago

I haven't yet checked what's required for Android to work as I'm only running iOS project now. I'll look into that soon unless someone else wants to give it a go.

bartonhammond commented 7 years ago

Do I still need to pull in PR #183 - Add missing whatwg-fetch dependency? Is that a pre-requesite for this PR? If it's not necessary to merge #183 please remove it and I'll focus on this one.

If I'm not able to get this to work w/ Android, I won't be able to merge this. Thanks for looking at this - I greatly appreciate it!

siemiatj commented 7 years ago

@bartonhammond No, #183 is completely separate. This missing dep is not even causing any problems afaik. Only throws errors in the console when installing.

As for the Android thing - I'll try to look into that over the weekend. To busy now :/ Just wanted to have all the steps required for iOS here before I'll forget them :)

siemiatj commented 7 years ago

@bartonhammond everything seems to be working fine now for both iOS and Android.

bartonhammond commented 7 years ago

I will get to this today. Thanks for working on this.

On Feb 27, 2017 5:50 AM, "Kuba Siemiątkowski" notifications@github.com wrote:

@bartonhammond https://github.com/bartonhammond everything seems to be working fine now for both iOS and Android.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bartonhammond/snowflake/pull/184#issuecomment-282699791, or mute the thread https://github.com/notifications/unsubscribe-auth/ABORPKik7wXA80RRAFEph-b--uQTkkTSks5rgrh9gaJpZM4MIAJU .

bartonhammond commented 7 years ago

@siemiatj Are you able to run npm test successfully? I am getting: Invariant Violation: Module name prefixes. If you are successful, how did you do that?

bartonhammond commented 7 years ago

@siemiatj - we have some problems that need to be addressed before I can merge this. I don't have the time to finish this. The following are some things I am aware of at this moment:

With the following diff applied to the package.json I was able to run the tests but 4 fail:

~/projects/snowflakework/snowflake-pr184 (siemiatj-master)$ git diff package.json
diff --git a/package.json b/package.json
index 92892ca..c295611 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
   "version": "0.2.0",
   "private": true,
   "jest": {
-    "preset": "jest-react-native",
+    "preset": "react-native",
     "moduleNameMapper": {
       "\\./datepicker$": "<rootDir>/node_modules/tcomb-form-native/lib/templates/bootstrap/datepicker.ios.js",
        "\\./select$": "<rootDir>/node_modules/tcomb-form-native/lib/templates/bootstrap/select.ios.js"
@@ -17,7 +17,7 @@
   "scripts": {
     "lint": "eslint . --fix --ignore-path .gitignore --format=node_modules/eslint-formatter-pretty",    
     "lint-validate": "eslint .  --ignore-path .gitignore  --quiet",
-    "test": "npm run lint-validate && jest -u",
+    "test": "jest",
     "start": "react-native start",
     "test:watch": "npm run test -- --watch",
     "test-chrome": "node-debug --preload false --nodejs --harmony jest --runInBand",
@@ -62,7 +62,6 @@
     "eslint-plugin-standard": "2.0.1",
     "istanbul": "0.4.5",
     "jest": "16.0.1",
-    "jest-react-native": "16.0.0",
     "react-addons-test-utils": "15.4.2",
     "redux-mock-store": "1.2.1"
   }

Results from npm test:

~/projects/snowflakework/snowflake-pr184 (siemiatj-master)$ npm test

> snowflake@0.2.0 test /Users/barton/projects/snowflakework/snowflake-pr184
> jest

Error: Unknown config option "transformIgnorePatterns" with value "node_modules/(?!(jest-)?react-native|react-clone-referenced-element)". This is either a typing error or a user mistake and fixing it will remove this message.
 PASS  src/reducers/profile/__tests__/profileReducer-test.js
  profileReducer
    PROFILE_REQUEST
      ✓ starts fetching (4ms)
      ✓ finishes fetching on success (11ms)
      ✓ finishes fetching on failure (1ms)
    PROFILE_UPDATE
      ✓ starts fetching on request
      ✓ finishes fetching on success
      ✓ finishes fetching on failure and saves error
    PROFILE_FORM_FIELD_CHANGE
      ✓ form is valid with valid email & username (8ms)
      ✓ form is invalid with invalid username (1ms)

 PASS  src/reducers/auth/__tests__/authReducer-test.js
  authReducer
    SESSION-TOKEN-REQUEST
      ✓ starts fetching (3ms)
      ✓ finishes fetching on success (1ms)
      ✓ finishes fetching on failure (1ms)
    SIGNUP_FAILURE
      ✓ Finish fetching with error (2ms)
    LOGOUT
      ✓ form is valid to logout (1ms)
      ✓ form is valid to logout even with form fields (1ms)
    FORGOT_PASSWORD
      ✓ form is not valid with empty field
      ✓ form is valid with valid email (2ms)
      ✓ form is invalid with invalid email (2ms)
    LOGIN
      ✓ form is not valid with empty fields (1ms)
      ✓ form is  valid with valid fields (1ms)
      ✓ form is invalid with invalid fields (1ms)
    REGISTER
      ✓ form is not valid with empty fields
      ✓ form is  valid with valid fields (1ms)
      ✓ form is  invalid with invalid fields (4ms)

 PASS  src/reducers/auth/__tests__/authActions-test.js
  authActions
    ✓ should set logoutState (1ms)
    ✓ should set registerState
    ✓ should set loginState (1ms)
    ✓ should set forgotPasswordState
    ✓ should set logoutRequest
    ✓ should set logoutSuccess (1ms)
    ✓ should set logoutFailure
    ✓ should set signupRequest
    ✓ should set signupSuccess (1ms)
    ✓ should set sessionTokenRequest
    ✓ should set sessionTokenRequestSuccess
    ✓ should set sessionTokenRequestFailure (1ms)
    ✓ should set signupFailure
    ✓ should set loginRequest
    ✓ should set loginSuccess
    ✓ should set loginFailure (1ms)
    ✓ should set resetPasswordRequest
    ✓ should set resetPasswordSuccess
    ✓ should set resetPasswordFailure (1ms)
    ✓ should set onAuthFormFieldChange (1ms)
    ✓ should logout (4ms)
    ✓ should login (1ms)
    ✓ should getSessionToken (2ms)
    ✓ should signup (2ms)
    ✓ should resetPassword (1ms)
    ✓ should deleteSessionToken

 PASS  src/reducers/profile/__tests__/profileActions-test.js
  profileActions
    ✓ should getProfileRequest (2ms)
    ✓ should getProfileSuccess (1ms)
    ✓ should getProfileFailure (1ms)
    ✓ should profileUpdateRequest
    ✓ should profileUpdateSuccess (2ms)
    ✓ should profileUpdateFailure (1ms)
    ✓ should onProfileFormFieldChange (1ms)
    ✓ should getProfile (2ms)
    ✓ should updateProfile (1ms)

 PASS  src/reducers/device/__tests__/deviceActions-test.js
  deviceActions
    ✓ should setPlatform (1ms)
    ✓ should setVersion (1ms)

 PASS  src/reducers/device/__tests__/deviceReducer-test.js
  deviceReducer
    init
      ✓ sets platform to an empty string (1ms)
      ✓ sets isMobile to false (1ms)
      ✓ sets version to null
    SET_PLATFORM
      ✓ modifies the platform and returns a new state (1ms)
    SET_VERSION
      ✓ modifies the version and returns a new state

 PASS  src/components/__tests__/ErrorAlert-test.js
  ErrorAlert
    ✓ should be fine (1ms)

 FAIL  src/components/__tests__/LoginForm-test.js
  ● Test suite failed to run

    Cannot find module 'react/lib/ReactTestRenderer' from 'LoginForm-test.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:144:17)
      at Object.<anonymous> (src/components/__tests__/LoginForm-test.js:30:24)

 FAIL  src/components/__tests__/ItemCheckbox-test.js
  ● Test suite failed to run

    Cannot find module 'react/lib/ReactTestRenderer' from 'ItemCheckbox-test.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:144:17)
      at Object.<anonymous> (src/components/__tests__/ItemCheckbox-test.js:18:24)

 FAIL  src/components/__tests__/Header-test.js
  ● Test suite failed to run

    Cannot find module 'react/lib/ReactTestRenderer' from 'Header-test.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:144:17)
      at Object.<anonymous> (src/components/__tests__/Header-test.js:22:24)

 FAIL  src/components/__tests__/FormButton-test.js
  ● Test suite failed to run

    Cannot find module 'react/lib/ReactTestRenderer' from 'FormButton-test.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:144:17)
      at Object.<anonymous> (src/components/__tests__/FormButton-test.js:20:24)

---------------------------|----------|----------|----------|----------|----------------|
File                       |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
---------------------------|----------|----------|----------|----------|----------------|
All files                  |    86.36 |    84.31 |    90.67 |    87.56 |                |
 components                |    76.92 |       50 |      100 |    76.92 |                |
  ErrorAlert.js            |    76.92 |       50 |      100 |    76.92 |       36,39,43 |
 lib                       |    96.43 |    92.31 |      100 |    96.43 |                |
  constants.js             |      100 |      100 |      100 |      100 |                |
  fieldValidation.js       |    96.43 |    92.31 |      100 |    96.43 |            156 |
 reducers/auth             |    85.96 |    88.89 |     90.2 |    86.73 |                |
  authActions.js           |    86.67 |       50 |     89.8 |    86.67 |... 306,363,413 |
  authFormValidation.js    |    92.31 |      100 |      100 |    92.31 |             76 |
  authInitialState.js      |      100 |      100 |      100 |      100 |                |
  authReducer.js           |    77.27 |    84.62 |      100 |    80.95 |155,157,171,178 |
 reducers/device           |    92.86 |       80 |      100 |      100 |                |
  deviceActions.js         |      100 |      100 |      100 |      100 |                |
  deviceInitialState.js    |      100 |      100 |      100 |      100 |                |
  deviceReducer.js         |       90 |       80 |      100 |      100 |                |
 reducers/profile          |    82.35 |       85 |    89.47 |       84 |                |
  profileActions.js        |    90.91 |      100 |    88.24 |    90.91 |         68,124 |
  profileFormValidation.js |      100 |      100 |      100 |      100 |                |
  profileInitialState.js   |      100 |      100 |      100 |      100 |                |
  profileReducer.js        |    69.57 |       75 |      100 |    72.73 |... 145,167,173 |
---------------------------|----------|----------|----------|----------|----------------|
Test Suites: 4 failed, 7 passed, 11 total
Tests:       66 passed, 66 total
Snapshots:   0 total
Time:        8.508s
Ran all test suites.
npm ERR! Test failed.  See above for more details.
siemiatj commented 7 years ago

Oh, ok I'll look into that. Sorry for the trouble, it's still new to me :) I did run npm test but not at the end so I'll check that as well.

bartonhammond commented 7 years ago

Kuba, don't worry about this right now...I freed up some time today to look into this. I've figured out why the Jest tests were failing and am in process of fixing that right now. I'll update the PR later once I have the tests working again.

On Mon, Feb 27, 2017 at 1:37 PM, Kuba Siemiątkowski < notifications@github.com> wrote:

Oh, ok I'll look into that. Sorry for the trouble, it's still new to me :) I did run npm test but not at the end so I'll check that as well.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bartonhammond/snowflake/pull/184#issuecomment-282828033, or mute the thread https://github.com/notifications/unsubscribe-auth/ABORPBbZ4a1xQlw0bFkdlwgZw-HGG54Tks5rgyYRgaJpZM4MIAJU .