willowtreeapps / react-formable

React Forms
25 stars 5 forks source link

Immediately invoked functions blow up in JEST #52

Closed uttrasey closed 8 years ago

uttrasey commented 8 years ago

Fine to use in our library code (browserify transform) but IIFE's blow up in JEST.

Put the following code into a JEST test and :boom:

() => {
    console.log('boom');
}();

Presumably something to do with our preprocessor.js??)

uttrasey commented 8 years ago

Turns out that while this does transpile fine for some reason it's probably better to use extra parenthesis as such (works on both)

(() => {
    console.log('boom');
})();

Going to leave this open for a few days then shut.