Socket
Socket
Sign inDemoInstall

all-contributors-cli

Package Overview
Dependencies
101
Maintainers
4
Versions
121
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.2 to 6.1.3

2

dist/contributors/__tests__/add.js

@@ -69,3 +69,3 @@ "use strict";

}
}, _callee, this);
}, _callee);
})));

@@ -72,0 +72,0 @@ test('add new contributor at the end of the list of contributors', function () {

@@ -52,3 +52,3 @@ "use strict";

}
}, _callee, this);
}, _callee);
})));

@@ -25,3 +25,10 @@ "use strict";

message: `What is the contributor's ${repo.getTypeName(options.repoType)} username?`,
when: !username
when: !username,
validate: function (input) {
if (!input) {
return 'Username not provided';
}
return true;
}
}, {

@@ -28,0 +35,0 @@ type: 'checkbox',

@@ -62,3 +62,3 @@ "use strict";

}
}, _callee, this);
}, _callee);
})));

@@ -87,3 +87,3 @@ test('Handle multiple results pages correctly',

}
}, _callee2, this);
}, _callee2);
})));

@@ -98,9 +98,9 @@

/*#__PURE__*/
_regenerator.default.mark(function _callee12(promise) {
_regenerator.default.mark(function _callee13(promise) {
var error;
return _regenerator.default.wrap(function (_context12) {
return _regenerator.default.wrap(function (_context13) {
while (1) {
switch (_context12.prev = _context12.next) {
switch (_context13.prev = _context13.next) {
case 0:
_context12.next = 2;
_context13.next = 2;
return promise.catch(function (e) {

@@ -111,3 +111,3 @@ return e;

case 2:
error = _context12.sent;
error = _context13.sent;
expect(error).toBeTruthy();

@@ -117,6 +117,6 @@

case "end":
return _context12.stop();
return _context13.stop();
}
}
}, _callee12, this);
}, _callee13);
}));

@@ -144,5 +144,8 @@ return _rejects.apply(this, arguments);

}
}, _callee3, this);
}, _callee3);
})));
test('handle github errors',
test('Throw error when no username is provided', function () {
expect(getUserInfo).toThrow('No login when adding a contributor. Please specify a username.');
});
test('Throw error when non existent username is provided',
/*#__PURE__*/

@@ -152,2 +155,3 @@ (0, _asyncToGenerator2.default)(

_regenerator.default.mark(function _callee4() {
var username;
return _regenerator.default.wrap(function (_context4) {

@@ -157,2 +161,36 @@ while (1) {

case 0:
username = 'thisusernamedoesntexist';
(0, _nock.default)('https://api.github.com').get(`/users/${username}`).reply(404, {
message: 'Not Found',
documentation_url: 'https://developer.github.com/v3/users/#get-a-single-user'
});
_context4.prev = 2;
_context4.next = 5;
return getUserInfo(username);
case 5:
_context4.next = 10;
break;
case 7:
_context4.prev = 7;
_context4.t0 = _context4["catch"](2);
expect(_context4.t0.message).toEqual(`Login not found when adding a contributor for username - ${username}.`);
case 10:
case "end":
return _context4.stop();
}
}
}, _callee4, null, [[2, 7]]);
})));
test('handle github errors',
/*#__PURE__*/
(0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee5() {
return _regenerator.default.wrap(function (_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
(0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {

@@ -162,3 +200,3 @@ message: "API rate limit exceeded for 0.0.0.0. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",

});
_context4.next = 3;
_context5.next = 3;
return rejects(getUserInfo('nodisplayname'));

@@ -168,6 +206,6 @@

case "end":
return _context4.stop();
return _context5.stop();
}
}
}, _callee4, this);
}, _callee5);
})));

@@ -178,7 +216,7 @@ test('fill in the name when null is returned',

/*#__PURE__*/
_regenerator.default.mark(function _callee5() {
_regenerator.default.mark(function _callee6() {
var info;
return _regenerator.default.wrap(function (_context5) {
return _regenerator.default.wrap(function (_context6) {
while (1) {
switch (_context5.prev = _context5.next) {
switch (_context6.prev = _context6.next) {
case 0:

@@ -191,7 +229,7 @@ (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {

});
_context5.next = 3;
_context6.next = 3;
return getUserInfo('nodisplayname');
case 3:
info = _context5.sent;
info = _context6.sent;
expect(info.name).toBe('nodisplayname');

@@ -201,6 +239,6 @@

case "end":
return _context5.stop();
return _context6.stop();
}
}
}, _callee5, this);
}, _callee6);
})));

@@ -211,7 +249,7 @@ test('attaches token when supplied',

/*#__PURE__*/
_regenerator.default.mark(function _callee6() {
_regenerator.default.mark(function _callee7() {
var mockAuthToken;
return _regenerator.default.wrap(function (_context6) {
return _regenerator.default.wrap(function (_context7) {
while (1) {
switch (_context6.prev = _context6.next) {
switch (_context7.prev = _context7.next) {
case 0:

@@ -222,3 +260,3 @@ mockAuthToken = 'myMock-token-adaskjda';

});
_context6.next = 4;
_context7.next = 4;
return getUserInfo('test-token', 'https://github.com', mockAuthToken);

@@ -228,6 +266,6 @@

case "end":
return _context6.stop();
return _context7.stop();
}
}
}, _callee6, this);
}, _callee7);
})));

@@ -238,6 +276,6 @@ test('attaches no token when supplied empty',

/*#__PURE__*/
_regenerator.default.mark(function _callee7() {
return _regenerator.default.wrap(function (_context7) {
_regenerator.default.mark(function _callee8() {
return _regenerator.default.wrap(function (_context8) {
while (1) {
switch (_context7.prev = _context7.next) {
switch (_context8.prev = _context8.next) {
case 0:

@@ -247,3 +285,3 @@ (0, _nock.default)('https://api.github.com').matchHeader('authorization', '').get('/users/test-token').reply(200, {

});
_context7.next = 3;
_context8.next = 3;
return getUserInfo('test-token', 'https://github.com', '');

@@ -253,6 +291,6 @@

case "end":
return _context7.stop();
return _context8.stop();
}
}
}, _callee7, this);
}, _callee8);
})));

@@ -263,6 +301,6 @@ test('attaches no token when not supplied',

/*#__PURE__*/
_regenerator.default.mark(function _callee8() {
return _regenerator.default.wrap(function (_context8) {
_regenerator.default.mark(function _callee9() {
return _regenerator.default.wrap(function (_context9) {
while (1) {
switch (_context8.prev = _context8.next) {
switch (_context9.prev = _context9.next) {
case 0:

@@ -272,3 +310,3 @@ (0, _nock.default)('https://api.github.com').matchHeader('authorization', '').get('/users/test-token').reply(200, {

});
_context8.next = 3;
_context9.next = 3;
return getUserInfo('test-token');

@@ -278,6 +316,6 @@

case "end":
return _context8.stop();
return _context9.stop();
}
}
}, _callee8, this);
}, _callee9);
})));

@@ -288,7 +326,7 @@ test('fill in the name when an empty string is returned',

/*#__PURE__*/
_regenerator.default.mark(function _callee9() {
_regenerator.default.mark(function _callee10() {
var info;
return _regenerator.default.wrap(function (_context9) {
return _regenerator.default.wrap(function (_context10) {
while (1) {
switch (_context9.prev = _context9.next) {
switch (_context10.prev = _context10.next) {
case 0:

@@ -301,7 +339,7 @@ (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {

});
_context9.next = 3;
_context10.next = 3;
return getUserInfo('nodisplayname');
case 3:
info = _context9.sent;
info = _context10.sent;
expect(info.name).toBe('nodisplayname');

@@ -311,6 +349,6 @@

case "end":
return _context9.stop();
return _context10.stop();
}
}
}, _callee9, this);
}, _callee10);
})));

@@ -321,7 +359,7 @@ test('append http when no absolute link is provided',

/*#__PURE__*/
_regenerator.default.mark(function _callee10() {
_regenerator.default.mark(function _callee11() {
var info;
return _regenerator.default.wrap(function (_context10) {
return _regenerator.default.wrap(function (_context11) {
while (1) {
switch (_context10.prev = _context10.next) {
switch (_context11.prev = _context11.next) {
case 0:

@@ -334,7 +372,7 @@ (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {

});
_context10.next = 3;
_context11.next = 3;
return getUserInfo('nodisplayname');
case 3:
info = _context10.sent;
info = _context11.sent;
expect(info.profile).toBe('http://www.github.com/nodisplayname');

@@ -344,6 +382,6 @@

case "end":
return _context10.stop();
return _context11.stop();
}
}
}, _callee10, this);
}, _callee11);
})));

@@ -354,7 +392,7 @@ test('retrieve user from a different github registry',

/*#__PURE__*/
_regenerator.default.mark(function _callee11() {
_regenerator.default.mark(function _callee12() {
var info;
return _regenerator.default.wrap(function (_context11) {
return _regenerator.default.wrap(function (_context12) {
while (1) {
switch (_context11.prev = _context11.next) {
switch (_context12.prev = _context12.next) {
case 0:

@@ -367,7 +405,7 @@ (0, _nock.default)('http://api.github.myhost.com:3000').get('/users/nodisplayname').reply(200, {

});
_context11.next = 3;
_context12.next = 3;
return getUserInfo('nodisplayname', 'http://github.myhost.com:3000');
case 3:
info = _context11.sent;
info = _context12.sent;
expect(info.name).toBe('No Display Name');

@@ -377,6 +415,6 @@

case "end":
return _context11.stop();
return _context12.stop();
}
}
}, _callee11, this);
}, _callee12);
})));

@@ -42,3 +42,3 @@ "use strict";

}
}, _callee9, this);
}, _callee9);
}));

@@ -66,3 +66,3 @@ return _rejects.apply(this, arguments);

}
}, _callee, this);
}, _callee);
})));

@@ -97,3 +97,3 @@ test('fill in the name when it is returned',

}
}, _callee2, this);
}, _callee2);
})));

@@ -128,3 +128,3 @@ test('fill in the name when null is returned',

}
}, _callee3, this);
}, _callee3);
})));

@@ -159,3 +159,3 @@ test('fill in the name when an empty string is returned',

}
}, _callee4, this);
}, _callee4);
})));

@@ -190,3 +190,3 @@ test('append http when no absolute link is provided',

}
}, _callee5, this);
}, _callee5);
})));

@@ -221,3 +221,3 @@ test('retrieve user from a different gitlab registry',

}
}, _callee6, this);
}, _callee6);
})));

@@ -252,3 +252,3 @@ test('retrieve user from a gitlab registry that needs a token',

}
}, _callee7, this);
}, _callee7);
})));

@@ -273,3 +273,3 @@ test('handle error when no token is offered',

}
}, _callee8, this);
}, _callee8);
})));

@@ -75,2 +75,6 @@ "use strict";

if (!username) {
throw new Error(`No login when adding a contributor. Please specify a username.`);
}
var root = hostname.replace(/:\/\//, '://api.');

@@ -85,3 +89,3 @@ return request.get({

if (!profile && body.message) {
throw new Error(body.message);
throw new Error(`Login not found when adding a contributor for username - ${username}.`);
}

@@ -88,0 +92,0 @@

@@ -68,3 +68,3 @@ "use strict";

}
}, _callee, this);
}, _callee);
})));

@@ -71,0 +71,0 @@ test('Should throw error and not allow editing config file if project name or owner is not set', function () {

{
"name": "all-contributors-cli",
"version": "6.1.2",
"version": "6.1.3",
"description": "Tool to easily add recognition for new contributors",

@@ -58,3 +58,3 @@ "bin": {

"git-cz": "^1.8.0",
"kcd-scripts": "^0.49.0",
"kcd-scripts": "^1.0.0",
"nock": "^10.0.6",

@@ -61,0 +61,0 @@ "semantic-release": "^15.13.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc