Skip to content

Commit

Permalink
test(deploy): catch swallowed copySync errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed Jan 16, 2016
1 parent 7d610fb commit 7718240
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions test/unit/deploy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
process.on('uncaughtException', function(err) {
console.error(err.stack);
});
// Test dependencies are required and exposed in common/bootstrap.js

var meminfo = fs.readFileSync('test/unit/fixtures/proc-meminfo', 'utf8');
Expand Down Expand Up @@ -1642,9 +1645,41 @@ exports['deploy.injectBinaryModules'] = {
);

test.done();
}).catch(error => test.fail(error));
}).catch(error => test.fail(error));
}).catch(error => {
test.fail(error);
test.done();
});
}).catch(error => {
test.fail(error);
test.done();
});
},

throwError: function(test) {
test.expect(1);

var errorMessage = 'Test Error';
this.copySync.onCall(0).throws(errorMessage);

this.getRoot = sandbox.stub(bindings, 'getRoot', () => {
return path.normalize('node_modules/bufferutil/');
});

deploy.resolveBinaryModules({
target: this.target
}).then(() => {
deploy.injectBinaryModules(this.globRoot, fsTemp.mkdirSync()).then(() => {
test.fail('Should not pass');
test.done();
}).catch(error => {
test.equal(error, errorMessage);
test.done();
});
}).catch(error => {
test.fail(error);
test.done();
});
}
};


Expand Down

0 comments on commit 7718240

Please sign in to comment.