Skip to content

Commit

Permalink
chore(package): update xo to version 0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and pvdlg committed Sep 3, 2018
1 parent 14283d1 commit e2eaac8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions lib/get-client.js
Expand Up @@ -97,11 +97,11 @@ const handler = (globalThrottler, limitKey) => ({
return pRetry(async () => {
try {
return await throttler.wrap(func)(...args);
} catch (err) {
if (SKIP_RETRY_CODES.includes(err.code)) {
throw new pRetry.AbortError(err);
} catch (error) {
if (SKIP_RETRY_CODES.includes(error.code)) {
throw new pRetry.AbortError(error);
}
throw err;
throw error;
}
}, RETRY_CONF);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/publish.js
Expand Up @@ -41,7 +41,7 @@ module.exports = async (pluginConfig, context) => {

try {
file = await stat(resolve(cwd, filePath));
} catch (err) {
} catch (error) {
logger.error('The asset %s cannot be read, and will be ignored.', filePath);
return;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/success.js
Expand Up @@ -75,11 +75,11 @@ module.exports = async (pluginConfig, context) => {
} else {
logger.log("Skip comment on issue #%d as it's open: %s", issue.number);
}
} catch (err) {
if (err.code === 404) {
} catch (error) {
if (error.code === 404) {
logger.error("Failed to add a comment to the issue #%d as it doesn't exists.", issue.number);
} else {
errors.push(err);
errors.push(error);
logger.error('Failed to add a comment to the issue #%d.', issue.number);
// Don't throw right away and continue to update other issues
}
Expand All @@ -101,8 +101,8 @@ module.exports = async (pluginConfig, context) => {
data: {html_url: url},
} = await github.issues.edit(updateIssue);
logger.log('Closed issue #%d: %s.', issue.number, url);
} catch (err) {
errors.push(err);
} catch (error) {
errors.push(error);
logger.error('Failed to close the issue #%d.', issue.number);
// Don't throw right away and continue to close other issues
}
Expand Down
8 changes: 4 additions & 4 deletions lib/verify.js
Expand Up @@ -59,13 +59,13 @@ module.exports = async (pluginConfig, context) => {
if (!push) {
errors.push(getError('EGHNOPERMISSION', {owner, repo}));
}
} catch (err) {
if (err.code === 401) {
} catch (error) {
if (error.code === 401) {
errors.push(getError('EINVALIDGHTOKEN', {owner, repo}));
} else if (err.code === 404) {
} else if (error.code === 404) {
errors.push(getError('EMISSINGREPO', {owner, repo}));
} else {
throw err;
throw error;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -48,7 +48,7 @@
"server-destroy": "^1.0.1",
"sinon": "^6.0.0",
"tempy": "^0.2.1",
"xo": "^0.22.0"
"xo": "^0.23.0"
},
"engines": {
"node": ">=8.3"
Expand Down
13 changes: 7 additions & 6 deletions test/get-client.test.js
Expand Up @@ -102,9 +102,9 @@ test('Wrap Octokit in a proxy', t => {
});

test('Use the global throttler for all endpoints', async t => {
const createRelease = stub().callsFake(async () => Date.now());
const createComment = stub().callsFake(async () => Date.now());
const issues = stub().callsFake(async () => Date.now());
const createRelease = stub().callsFake(() => Date.now());
const createComment = stub().callsFake(() => Date.now());
const issues = stub().callsFake(() => Date.now());
const octokit = {repos: {createRelease}, issues: {createComment}, search: {issues}, authenticate: stub()};
const rate = 150;
const github = proxyquire('../lib/get-client', {
Expand Down Expand Up @@ -132,9 +132,9 @@ test('Use the global throttler for all endpoints', async t => {
});

test('Use the same throttler for endpoints in the same rate limit group', async t => {
const createRelease = stub().callsFake(async () => Date.now());
const createComment = stub().callsFake(async () => Date.now());
const issues = stub().callsFake(async () => Date.now());
const createRelease = stub().callsFake(() => Date.now());
const createComment = stub().callsFake(() => Date.now());
const issues = stub().callsFake(() => Date.now());
const octokit = {repos: {createRelease}, issues: {createComment}, search: {issues}, authenticate: stub()};
const searchRate = 300;
const coreRate = 150;
Expand Down Expand Up @@ -164,6 +164,7 @@ test('Use the same throttler for endpoints in the same rate limit group', async
});

test('Use the same throttler when retrying', async t => {
// eslint-disable-next-line require-await
const createRelease = stub().callsFake(async () => {
const err = new Error();
err.time = Date.now();
Expand Down

0 comments on commit e2eaac8

Please sign in to comment.