GeekyAnts / react-native-seed

Get your favorite boilerplate of React Native
http://ReactNativeSeed.com
652 stars 15 forks source link

precommit failed (help pls) #11

Closed MichelDiz closed 6 years ago

MichelDiz commented 6 years ago

Hi, i'm trying this Seed of yours. But I having some issues with it.

I'm using the Typescript with mobx.

I can't precommit because the Jest is seeking for erros in others files:

PS. But Before precommit I have to "clean" to erase the artifacts files. Jest is looking for it too. Which are the recommendation in that case?

Cheers

=> yarn precommit
yarn run v1.3.2
$ yarn test
$ yarn jest && tslint src/**/*.tsx && eslint .
$ node node_modules/jest/bin/jest.js
 PASS  src/store/DomainStore/HomeStore.test.tsx
 FAIL  src/stories/screens/Login/__tests__/index.test.tsx
  ● Test suite failed to run

    /Volumes/HSierraDados/Dev-2018/app/Oficial_keybase/app/node_modules/react-native-iphone-x-helpe
r/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { Dimens
ions, Platform } from 'react-native';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:11:31)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/index.js:3:23)

 FAIL  src/stories/screens/Home/__tests__/index.test.tsx
  ● Test suite failed to run

    /Volumes/HSierraDados/Dev-2018/app/Oficial_keybase/app/node_modules/react-native-iphone-x-helpe
r/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { Dimens
ions, Platform } from 'react-native';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:11:31)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/index.js:3:23)

 FAIL  src/stories/screens/BlankPage/__tests__/index.test.tsx
  ● Test suite failed to run

    /Volumes/HSierraDados/Dev-2018/app/Oficial_keybase/app/node_modules/react-native-iphone-x-helpe
r/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { Dimens
ions, Platform } from 'react-native';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:11:31)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/index.js:3:23)

 FAIL  src/stories/screens/Sidebar/__tests__/index.test.tsx
  ● Test suite failed to run

    /Volumes/HSierraDados/Dev-2018/app/Oficial_keybase/app/node_modules/react-native-iphone-x-helpe
r/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { Dimens
ions, Platform } from 'react-native';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:11:31)
      at Object.<anonymous> (node_modules/react-native-keyboard-aware-scroll-view/index.js:3:23)

Test Suites: 4 failed, 1 passed, 5 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        9.054s
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.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
MichelDiz commented 6 years ago

Solved changing the Jest config in Package.json:

 "jest": {
    "preset": "jest-expo",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "transform": {
      "^.+\\.(js)$": "<rootDir>/node_modules/babel-jest",
      "\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
    "transformIgnorePatterns": [
      "node_modules/(?!(fbjs|react-native-iphone-x-helper|react-native|lottie-react-native|expo|react-native-maps|react-native-svg|react-native-branch|native-base-shoutem-theme|react-native-easy-grid|react-native-drawer|react-native-vector-icons|react-native-keyboard-aware-scroll-view|react-navigation|native-base|@expo|react-native-scrollable-tab-view)/)"
    ]
  }