A potential setup is :
- Test runner - this is the glue between gulp and karma and provides option to set the karma
options.files
with the gulp.src() stream. Frankly if you have no steps before your karma tests, then use karma directly within gulp task, without gulp plugin. - Use associated karma plugins, to run on phantom/chrome/firefox
- Use associated karma plugins for coverage, alt-js compilation
- More plugins & configuring karma options for reporting of tests and coverage.
Using browserify will change the whole setup above.
- Since it needs to resolve requires, it must run on all the "entry point" files. Typically your tests should require sources, and must be entry points.
- Use karma-bro - it solves the problems in karma-browserify (ATM this doesnt even work - it cant work with bfy 5.0 api) & karma-browserifast.
- Coverage becomes tricky since sources/vendor-sources/tests are all bundled. So I had created a custom coverage transform, that marks which code whould be instrumented while bfy is bundling
- browserify should be a "preprocessor" in karma.
- A bunch of "transform: []" should be configured in browserfy options
- The transforms can be configured by taking an existing transform module and wrapping with a custom module like what I did above for browserify-istanbul