var es = require('event-stream')
  , path = require('path')
  , findup = require('findup-sync')
  , origCwd = process.cwd();

module.exports = function(config) {
  config.set({
    autoWatch: true,
    frameworks: ['mocha', 'sinon-chai', 'browserify'],
    browsers: ['Chrome'],
    files: ['spec/*.js'],
    preprocessors: {
      '**/*.js': ['browserify']
    },
    reporters: ['progress'],
    browserify: {
      transform: [
        function(file) {
          // XXX so hacky
          process.chdir(path.dirname(findup('bower.json')));
          return es.mapSync(function(data) {
            return data;
          });
        },
        require('../../browserify/dereqify.js'),
        require('../../browserify/derrorify.js').transform,
        'dehtmlify',
        'decomponentify',
        'debowerify',
        function(file) {
          process.chdir(origCwd);
          return es.mapSync(function(data) {
            return data;
          });
        }
      ],
      postBundle: require('../../browserify/derrorify.js').postBundleCb,
      watch: true
    }
  });
};
@@ -116,18 +116,135 @@
 ss.cwd()
+%0A  , root = path.dirname(findup('bower.json'))%0A  , derrify = require('derrify')(path.join(root, 'lib/error/err.msg'))
 ;%0A
-
 %0Amodule.
@@ -620,42 +620,12 @@
 dir(
-path.dirname(findup('bower.json'))
+root
 );%0A 
@@ -739,33 +739,16 @@
 re('
-../../browserify/
 dereqify
 .js'
@@ -743,19 +743,16 @@
 dereqify
-.js
 '),%0A    
@@ -759,49 +759,16 @@
     
-require('../../browserify/
 derr
-or
 ify.
-js').
 tran
@@ -1027,49 +1027,16 @@
 le: 
-require('../../browserify/
 derr
-or
 ify.
-js').
 post

fix path-dependent browserify transforms