Skip to content

Commit

Permalink
Fixed squirrel.rm and added a basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew McNamara committed Nov 21, 2014
1 parent 5729ad3 commit c30d3fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion installer.js
Expand Up @@ -127,7 +127,8 @@ exports.prepare = function(opts) {
**/
exports.remove = function(opts) {
return function(target, callback) {
var cmdline = _.template(opts.uninstallCommand, {
var commandTemplate = _.template(opts.uninstallCommand);
var cmdline = commandTemplate({
opts: opts,
target: target,
version: opts.versions[target] || 'latest'
Expand Down
18 changes: 18 additions & 0 deletions test/removal.js
@@ -0,0 +1,18 @@
var squirrel = require('../'),
expect = require('expect.js'),
exec = require('child_process').exec;

describe('remove module tests', function() {
before(function(done) {
squirrel('nopt', done);
});

it('should successfully uninstall a module', function(done) {
squirrel.rm('nopt', function() {
exec("npm list", function(err, stdout) {
expect(stdout).not.to.contain('nopt');
done(err);
})
})
});
});

0 comments on commit c30d3fb

Please sign in to comment.