Skip to content

Instantly share code, notes, and snippets.

@johntron
Created January 16, 2014 22:47
Show Gist options
  • Save johntron/8464997 to your computer and use it in GitHub Desktop.
Save johntron/8464997 to your computer and use it in GitHub Desktop.
var read = require('fs').readFileSync;
module.exports = function (builder) {
builder.hook('before scripts', function (pkg, next) {
var config = pkg.config,
tests = config.tests,
development = config.development;
if (!tests) return next();
tests.forEach(function (test) {
var path = pkg.path(test),
contents = read(path, 'utf8');
pkg.addFile('scripts', test, contents);
});
Object.keys(development).forEach(function (dependency) {
pkg.dependencies[dependency] = development[dependency];
});
return next();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment