lib/bro.js
function addBundleFile(bundleFile, config) {

    var files = config.files,
        preprocessors = config.preprocessors;

    // list of patterns using our preprocessor
    var patterns = reduce(preprocessors, function(matched, val, key) {
      if (val.indexOf('browserify') !== -1) {
        matched.push(key);
      }
      return matched;
    }, []);

    // first file being preprocessed
    var file = find(files, function(f) {
      return some(patterns, function(p) {
        return minimatch(f.pattern, p);
      });
    });

    var idx = 0;

    if (file) {
      idx = files.indexOf(file);
    } else {
      log.debug('no matching preprocessed file was found, defaulting to prepend');
    }

    log.debug('add bundle to config.files at position', idx);

    // insert bundle on the correct spot
    files.splice(idx, 0, {
      pattern: bundleFile.location,
      served: true,
      included: true,
      watched: true
    });
  }
function addBundleFile(bundleFile, config) {

    var files = config.files,
        preprocessors = config.preprocessors;

    // list of patterns using our preprocessor
    var patterns = reduce(preprocessors, function(matched, val, key) {
      if (val.indexOf('browserify') !== -1) {
        matched.push(key);
      }
      return matched;
    }, []);

    // first file being preprocessed
    var file = find(files, function(f) {
      return some(patterns, function(p) {
        return minimatch(f.pattern, p);
      });
    });

    var idx = 0;

    if (file) {
      idx = files.indexOf(file);
    } else {
      log.debug('no matching preprocessed file was found, defaulting to prepend');
    }

    log.debug('add bundle to config.files at position', idx);

    // insert bundle on the correct spot
    files.splice(idx, 0, {
      pattern: bundleFile.location,
      served: true,
      included: true,
      watched: true
    });
  }
function addBundleFile ( bundleFile , config ) { var files = config . files , preprocessors = config . preprocessors ; // list of patterns using our preprocessor var patterns = reduce ( preprocessors , function ( matched , val , key ) { if ( val . indexOf ( 'browserify' ) !== - 1 ) { matched . push ( key ) ; } return matched ; } , [ ] ) ; // first file being preprocessed var file = find ( files , function ( f ) { return some ( patterns , function ( p ) { return minimatch ( f . pattern , p ) ; } ) ; } ) ; var idx = 0 ; if ( file ) { idx = files . indexOf ( file ) ; } else { log . debug ( 'no matching preprocessed file was found, defaulting to prepend' ) ; } log . debug ( 'add bundle to config.files at position' , idx ) ; // insert bundle on the correct spot files . splice ( idx , 0 , { pattern : bundleFile . location , served : true , included : true , watched : true } ) ; }
Add bundle file to the list of files in the
configuration, right before the first browserified
test file and after everything else.

That makes sure users can include non-commonJS files
prior to the browserified bundle.

@param {BundleFile} bundleFile the file containing the browserify bundle
@param {Object} config the karma configuration to be updated
Add bundle file to the list of files in the configuration right before the first browserified test file and after everything else .