jfirebaugh / konacha

Test your Rails application's JavaScript with the mocha test framework and chai assertion library
Other
1.05k stars 117 forks source link

Require commonjs module, e.g. export.default #224

Closed ivawzh closed 8 years ago

ivawzh commented 8 years ago

I want to test my javascript in a dependency injection manner, e.g.

_ = require('lodash')
describe('lodash should work', ....)

Is there anyway that I can use commonjs's module require in Konacha? I know //= require can load file, but how do I assign the loaded file/method to a variable? Cheers

jfirebaugh commented 8 years ago

Konacha is built on top of the Rails asset pipeline. You will need to investigate ways of using CommonJS with the asset pipeline.