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

Replace Jest with Mocha and JSDom; replace Node.js with io.js #78

Closed
wants to merge 1 commit into from

Conversation

koistya
Copy link
Member

@koistya koistya commented Mar 8, 2015

@cesarandreu
Copy link

Personally, I'd make a test/helper.js file. I'm doing something similar, this is what it currently looks like:

'use strict'

module.exports = {testdom, cleanup}

function testdom (markup='') {
  if (typeof document === 'undefined') {
    var jsdom = require('jsdom').jsdom
    global.document = jsdom(markup)
    global.window = document.defaultView
    global.navigator = window.navigator
  }
}

function cleanup () {
  var React = require('react')
  React.unmountComponentAtNode(document.body)
  document.body.innerHTML = ''
}

@koistya
Copy link
Member Author

koistya commented Mar 8, 2015

@cesarandreu nice tip!

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

Successfully merging this pull request may close these issues.

2 participants