Coder Social home page Coder Social logo

axelnormand / react-native-typescript-wallaby-jest Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 111 KB

skeleton project for create react native app and typescript

JavaScript 58.85% TypeScript 41.15%
react react-native typescript jest storybook storyshots prettier tslint

react-native-typescript-wallaby-jest's Introduction

Skeleton create react native app with typescript

All the config I found quite a pain to setup so maybe this will help someone.

Any feedback appreciated.

Install & Run

Global installs

  • install node 8+
  • npm install --global yarn
  • yarn global add typescript
  • yarn global add jest

Then build & run project

  • yarn install
  • yarn start to run
  • yarn test to jest tests
  • yarn storybook to run storybook
  • yarn lint to run tslint

Notes

  • Storybook and storyshots. Uses storyloader to auto generate all requires from *.story.tsx to use on storyshots.test.ts
  • Typescript config transpiles jsx for wallaby
  • Expo set to preprocess ts files in app.json
  • Jest has to use ts-jest to compile ts and then babel to hoist jest.mock()
  • Jest coverage to JUnit xml
  • Some nice TS Lint rules
  • JSDom with Enzyme setup so can use shallow and mount and looks nice in jest snapshots with enzyme serializer
  • Prettier is awesome
  • Wallaby also awesome

react-native-typescript-wallaby-jest's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-typescript-wallaby-jest's Issues

Error with. jest

Hello, thanks for this repo,
i. have an. issue when i run wallaby, and yarn jest

here the description

$ /Users/macbookpro/code/test/wallabytest/react-native-typescript-wallaby-jest/node_modules/.bin/jest
 FAIL  src/app/App/App.test.tsx
  ● Test suite failed to run

    /Users/macbookpro/code/test/wallabytest/react-native-typescript-wallaby-jest/node_modules/react-native/jest/setup.js: babel-plugin-jest-hoist: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.
    Invalid variable access: console
    Whitelisted objects: Array, ArrayBuffer, Boolean, DataView, Date, Error, EvalError, Float32Array, Float64Array, Function, Generator, GeneratorFunction, Infinity, Int16Array, Int32Array, Int8Array, InternalError, Intl, JSON, Map, Math, NaN, Number, Object, Promise, Proxy, RangeError, ReferenceError, Reflect, RegExp, Set, String, Symbol, SyntaxError, TypeError, URIError, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet, arguments, expect, jest, require, undefined, global, clearInterval, clearTimeout, setInterval, setTimeout, queueMicrotask, clearImmediate, setImmediate.
    Note: This is a precaution to guard against uninitialized mock variables. If it is ensured that the mock is required lazily, variable names prefixed with `mock` are permitted.
      
      at invariant (node_modules/babel-plugin-jest-hoist/build/index.js:12:11)

what can i. do to fix that ?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.