granary
Version:
Dependency Bundling for NPM and Bower
38 lines (32 loc) • 1.2 kB
JavaScript
var path = require('path');
var fs = require('fs');
var spawn = require('child_process').spawn;
var cli = '';
describe('granary', function() {
before(function(done) {
this.timeout(50000);
// run the npm start task in the granary-server directory
cli = spawn('npm', ['run', 'start'], {
cwd: path.resolve('node_modules', 'granary-server'),
env: process.env
});
cli.stdout.on('data', function(data) {
var message = data.toString('utf8');
if(message.indexOf('INFO granary-server: Granary Server is now running port 8872') > -1) {
var config = JSON.parse(fs.readFileSync(path.resolve('node_modules', 'granary-server', 'config', 'dev.json')));
process.CORRECT_PASSWORD = config.password;
done();
}
console.log(message); // eslint-disable-line no-console
});
cli.stderr.on('data', function (data) {
console.log('err data: ' + data); // eslint-disable-line no-console
cli.kill();
});
});
require('./create');
after(function(done) {
cli.kill();
done()
});
});