nikku / karma-browserify

A fast Browserify integration for Karma that handles large projects with ease
MIT License
321 stars 49 forks source link

Is it possible to modify bundle before passing it to karma? #156

Closed anius closed 8 years ago

anius commented 8 years ago

I need to modify content in some nested require file so it is not possible to do it on prebundle event as I see only var myModule = require('myModule'). I was wondering if it's possible to replace some text in the bundle after the content was browserified (postbundle or similar):

  browserify: {
      paths: 'myPath',
      extensions: ['.js', '.html'],
      configure: function (bundle) {
        bundle.on('bundled', function () {
          // Here I would like on postbundle or bundled event to replace
          // some content in generated bundled file and then it pass back to karma
        });
      }
    }
bendrucker commented 8 years ago

You can handle that via a browserify transform or plugin depending on the nature of your need