mantoni/mochify.js

Unable to pass Browserify transform arguments

Closed this issue · 2 comments

I'm trying to call Mochify and pass two Browserify transforms. I'm doing this with
--transform [ ejsify [ babelify --presets babel-preset-es2015 ] ].
This results in the opts object holding this value for transform:
{"_":["ejsify",{"_":["babelify"],"presets":"babel-preset-es2015"}]}.

So, when lines 157-165 execute, they call b.transform({"_":["ejsify",{"_":["babelify"],"presets":"babel-preset-es2015"}]}, "ejsify") once, instead of performing one b.transform() call for both "babelify" and "ejsify".

You have to pass multiple transforms by specifying --transform multiple times. This behavior is in line with Browserify.
Let me know if that works for you.

I managed to work it out… for viewers at home, I'm also using grunt-mochify, which requires options be passed like so:

                options:
                {
                    phantomjs: '/Applications/slimerjs/slimerjs',
                    reporter: 'spec',
                    transform: 'ejsify'
                }

As you can see, you can't normally supply more than one transform value, but I was able to finagle it b changing transform's value to 'ejsify --transform [ babelify --presets babel-preset-es2015 ]'.split(' ').