TDD Browserify and ReactJS

I'm trying to find a good, clean, way to test React components. I'm liking the idea of mochify as it looks like it abstracts a lot of the hassle of test runners, works with webdriver/saucelabs, etc.

The trouble is that I'm using Browserify with various transforms for jsx, coffee, less, etc from the command line. And can't find how get mochify to run those transforms.

How do I do this?

Or is there a better option out there... Karma maybe?



Browserify transforms can also be specified in package.json, for example:

"devDependencies": {
  "browserify": "*",
  "coffeeify": "^0.6.0",
  "mocha": "*",
  "mochify": "*",
  "reactify": "^0.13.1"
"browserify": {
  "transform": [

In your test files, just requires the actual component file using relative path, and write tests as you normally do with mocha:

var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
var MyComponent = require('../src/app/MyComponent');

Edit: Mochify now supports additional transforms and plugins with --transform and --plugin.

This problem will be addressed in a future release of Mochify.

Make sure to watch the issue on GitHub.

Need Your Help

Sorting specific sections in Core Data

objective-c ios core-data

I am using NSFetchedResultsController to populate the tableView of my application it is group by section(in which case a category property in my core data object) I want to reorder the section manu...

Performance: better to inizialize variable or just fill it?

c++ memory-management struct c++builder

Let's say i have a function that is called 10 times a second, something like:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.