Skip to content

Commit

Permalink
fix remote tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 31, 2012
1 parent 9058a5a commit e572a93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var Emitter = require('events').EventEmitter
, request = require('superagent')
, debug = require('debug')('component:installer')
, Batch = require('batch')
, http = require('http')
, fs = require('fs');

/**
Expand Down Expand Up @@ -153,7 +154,8 @@ Package.prototype.getJSON = function(fn){
}
fn(null, json);
} else {
var err = new Error('failed to fetch ' + url);
var name = http.STATUS_CODES[res.status];
var err = new Error('failed to fetch ' + url + ', got ' + res.status + ' "' + name + '"');
err.status = res.status;
fn(err);
}
Expand Down
4 changes: 2 additions & 2 deletions test/remotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ describe('component install from remote', function(){
exec('bin/component install private-registry/testcomponent', function(err, stdout, stderr){
if (err) return done(err);
stderr.should.include('error');
stderr.should.include('failed to fetch http://admin:abcd@localhost:3001');
stderr.should.include('got 401 response');
stderr.should.include('failed to fetch http://admin:abcd@localhost:3001/private-registry/testcomponent/master/component.json');
stderr.should.include('got 401 "Unauthorized"');
assert(!exists('components/private-registry-testcomponent/component.json'),
'component should not be installed');
done();
Expand Down

0 comments on commit e572a93

Please sign in to comment.