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

Migrate tests to Mocha #163

Merged
merged 11 commits into from
Oct 28, 2014
Merged

Migrate tests to Mocha #163

merged 11 commits into from
Oct 28, 2014

Conversation

danvk
Copy link
Contributor

@danvk danvk commented Oct 28, 2014

The name says it all. High order bits:

  • I'm not using proxyquire because its @global feature mucks with the node.js module cache & fundamentally breaks React, which expects to only be loaded once.
  • We apply the JSX transformer to anything with an @jsx in it. I tried renaming all our components to .jsx, but this made node-inspector less pleasant.
  • It's still helpful to mock out BioDalliance and the AttributeCharts. I did this via the preprocessor and a global list of React Components to mock. Mocks are now opt-in.
  • Since we're no longer using Jasmine, I switched to sinon for stubs and assert for tests. We can use something fancier like chai if you prefer.

Tests run a lot faster now, and hopefully less flakily!

Fixes #128

@@ -0,0 +1,11 @@
// Via http://www.asbjornenge.com/wwc/testing_react_components.html
module.exports = function(markup) {
if (typeof document !== 'undefined') return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd guess it's there to make this a no-op in a real browser.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see the attribution now, makes sense.

@ihodes
Copy link
Member

ihodes commented Oct 28, 2014

Awesome! LGMT % travis + a few comments.

ihodes added a commit that referenced this pull request Oct 28, 2014
@ihodes ihodes merged commit 3b79063 into master Oct 28, 2014
@ihodes ihodes deleted the mocha2 branch October 29, 2014 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Travis build is flaky
2 participants