Git Product home page Git Product logo

Comments (6)

derekgreenberg avatar derekgreenberg commented on May 8, 2024 1

Ok, might as well show some other changes made for this:

Added /jest directory

In package.json under 'scripts:

Replace Ava stuff with Jest stuff:

Remove

    "test": "ava",
     "test:watch": "ava --watch",
     "coverage": "nyc ava && nyc report --reporter=html && open coverage/index.html || xdg-open coverage/index.html",

Replace:

    "test": "jest",
    "updateSnapshot": "jest --updateSnapshot",
    "test:watch": "jest --watch",
    "coverage": "nyc jest && nyc report --reporter=html && open coverage/index.html || xdg-open coverage/index.html",

in package.json, removed Ava node

 "ava": {
     "files": [
       "Tests/**/*.js",
       "!Tests/Setup.js"
     ],	
     "require": [		
       "babel-register",		
       "babel-polyfill",		
       "react-native-mock/mock",		
      "./Tests/Setup"		
    ],		
    "babel": "inherit"

in package.json added Jest node

  "jest": {
    "preset": "react-native",
    "setupFiles": [
      "./jest/setup.js"
    ]
  },

Removed unused devDependencies from package.json

"enzyme": "^2.6.0",
"react-dom": "^15.4.0",
"react-native-mock": "^0.3.1",

Added Jest devDependencies in package.json

"babel-preset-react-native": "1.9.1",
"jest": "^19.0.2",
"jest-react-native": "^18.0.0",
"react-test-renderer": "^15.5.4",

Added: jest/setup.js

// add any mocks you need, based on any mocks you created previously for Ava. The following is
// just an example that you can use to create your own mock!!!

jest
.mock('react-native-device-info', () => {
return { isTablet: jest.fn() }
})
.mock('react-native-router-flux', () => {
return {
Actions: {'myScreen': () => {}},
ActionConst: {RESET: 'reset'}
}
})
.mock('react-native-keyboard-spacer', () => 'KeyboardSpacer')
.mock('react-native-i18n', () => {
const english = require('../App/I18n/languages/english.json')
const keys = require('ramda')
const replace = require('ramda')
const forEach = require('ramda')

return {
t: (key, replacements) => {
let value = english[key]
if (!value) return key
if (!replacements) return value

  forEach((r) => {
    value = replace(`{{${r}}}`, replacements[r], value)
  }, keys(replacements))
  return value
}

}
})

from ignite-andross.

jamonholmgren avatar jamonholmgren commented on May 8, 2024

Added to our next Ignite core team meeting agenda.

from ignite-andross.

jamonholmgren avatar jamonholmgren commented on May 8, 2024

cc @derekgreenberg @robinheinze

from ignite-andross.

derekgreenberg avatar derekgreenberg commented on May 8, 2024

I used jest-codemods to port the Ava unit tests over to Jest for a project (built from ignite 2.0) and it worked perfectly.

from ignite-andross.

skellock avatar skellock commented on May 8, 2024

Sorceror!

from ignite-andross.

jamonholmgren avatar jamonholmgren commented on May 8, 2024

Fixed in #30 . 🎉 🌮

from ignite-andross.

Related Issues (20)

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.