How can I use Jest to test React components written in CoffeeScript + React jsx?
The only CoffeeScript example provided with Jest uses plain CoffeeScript, and doesn\
Based on user2534631's template project, I enhanced to use coffee-react-transform to compile CJSX files.
https://github.com/redice/jest-react-coffeescript
var coffee = require('coffee-script');
var transform = require('coffee-react-transform');
module.exports = {
process: function(src, path) {
if (coffee.helpers.isCoffee(path)) {
compiled_cjx = transform(src);
compiled_to_react = coffee.compile(compiled_cjx, {bare: true});
return compiled_to_react;
}
return src;
}
};
So use CJSX syntax to write React components.
render: ->