nikku/karma-browserify

Use parcelify with karma

mediafreakch opened this issue · 4 comments

Hello,

I'd like to use parcelify as a browserify-plugin in a karma test. My karma.conf.js contains this:

browserify: {
    plugin: [ [ 'parcelify', { o: './bundle.css' } ] ]
}

However this doesn't work. I found out that this is because karma-browserify is adding the test-files to be bundled with w.require on bro.js#L317.

Seems that parcelify only works on entry files. If I change that line to w.add, parcelify does its job.
Can you help me understanding that part and maybe even outline the path to a working solution?

Many thanks.
Edi

nikku commented

From what I remember w.add is just a shorthand for w.require(..., { expose: false }) so I wonder why it should not be working.

Some details on our implementation: In order to properly work together with karma and benefit from watchify's incremental re-building we require all the actual test files via stubs (check the developer console to see the stub files as well as the one single generated bundle).

If you need more help from our side, please upload an example project somewhere on GitHub that shows your case and allows us to look into it, too.

Anyhow it seems like you take some more time to investigate the issue and ask the parcelify guys to land a fix.

nikku commented

Closing this for now.

I wasn't able to get to the bottom of this. A first milestone would be to find out what has to be fixed in which github repo. Is it a browserify issue? A karma-browserify issue or a parcelify issue?

I added a repository for you to reproduce the case:
https://github.com/mediafreakch/parcelify-karma-browserify

Could you help with that?