Skip to content

Commit

Permalink
Update dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 3, 2018
1 parent cf56247 commit 9c50d26
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
"url-parse-lax": "^3.0.0"
},
"devDependencies": {
"ava": "1.0.0-beta.7",
"ava": "1.0.0-beta.8",
"coveralls": "^3.0.0",
"delay": "^3.0.0",
"delay": "^4.0.0",
"form-data": "^2.1.1",
"get-port": "^4.0.0",
"nyc": "^12.0.2",
"nyc": "^13.0.1",
"p-event": "^2.1.0",
"pem": "^1.4.4",
"proxyquire": "^2.0.1",
Expand All @@ -59,7 +59,7 @@
"tempfile": "^2.0.0",
"tempy": "^0.2.1",
"tough-cookie": "^2.4.3",
"xo": "^0.22.0"
"xo": "^0.23.0"
},
"ava": {
"concurrency": 4
Expand Down
4 changes: 2 additions & 2 deletions source/request-as-event-emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ module.exports = options => {
let backoff;
try {
backoff = options.gotRetry.retries(++retryTries, error);
} catch (error) {
emitter.emit('error', error);
} catch (error2) {

This comment has been minimized.

Copy link
@szmarczak

szmarczak Sep 3, 2018

Collaborator

Why did you rename error to error2?

This comment has been minimized.

Copy link
@sindresorhus

sindresorhus Sep 3, 2018

Author Owner

Because it's shadowing the error on line 193. This makes it clearer.

This comment has been minimized.

Copy link
@szmarczak

szmarczak Sep 3, 2018

Collaborator

Yeah... you're right.

emitter.emit('error', error2);
return;
}

Expand Down
12 changes: 6 additions & 6 deletions test/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test('url should be utf-8 encoded', async t => {
});

test('string url with query is preserved', async t => {
const path = `/?test=http://example.com?foo=bar`;
const path = '/?test=http://example.com?foo=bar';
const response = await got(`${s.url}${path}`);
t.is(response.body, path);
});
Expand Down Expand Up @@ -110,7 +110,7 @@ test('overrides querystring from opts', async t => {
test('escapes query parameter values', async t => {
const response = await got(`${s.url}`, {
query: {
test: `it’s ok`
test: 'it’s ok'
}
});
t.is(response.body, '/?test=it%E2%80%99s+ok');
Expand Down Expand Up @@ -201,25 +201,25 @@ test('allows extra keys in `hooks`', async t => {
test('baseUrl works', async t => {
const instanceA = got.extend({baseUrl: `${s.url}/test`});
const {body} = await instanceA('/foobar');
t.is(body, `/test/foobar`);
t.is(body, '/test/foobar');
});

test('accepts WHATWG URL as the baseUrl option', async t => {
const instanceA = got.extend({baseUrl: new URL(`${s.url}/test`)});
const {body} = await instanceA('/foobar');
t.is(body, `/test/foobar`);
t.is(body, '/test/foobar');
});

test('backslash in the end of `baseUrl` is optional', async t => {
const instanceA = got.extend({baseUrl: `${s.url}/test/`});
const {body} = await instanceA('/foobar');
t.is(body, `/test/foobar`);
t.is(body, '/test/foobar');
});

test('backslash in the beginning of `url` is optional when using baseUrl', async t => {
const instanceA = got.extend({baseUrl: `${s.url}/test`});
const {body} = await instanceA('foobar');
t.is(body, `/test/foobar`);
t.is(body, '/test/foobar');
});

test('throws when trying to modify baseUrl after options got normalized', async t => {
Expand Down
10 changes: 5 additions & 5 deletions test/cancel.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ test('cancel immediately', async t => {
test('recover from cancelation using cancelable promise attribute', async t => {
// Canceled before connection started
const p = got('http://example.com');
const recover = p.catch(err => {
const recover = p.catch(error => {
if (p.isCanceled) {
return;
}

throw err;
throw error;
});

p.cancel();
Expand All @@ -134,12 +134,12 @@ test('recover from cancelation using cancelable promise attribute', async t => {
test('recover from cancellation using error instance', async t => {
// Canceled before connection started
const p = got('http://example.com');
const recover = p.catch(err => {
if (err instanceof got.CancelError) {
const recover = p.catch(error => {
if (error instanceof got.CancelError) {
return;
}

throw err;
throw error;
});

p.cancel();
Expand Down
2 changes: 1 addition & 1 deletion test/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test('create', async t => {

test('custom endpoint with custom headers (extend)', async t => {
const instance = got.extend({headers: {unicorn: 'rainbow'}, baseUrl: s.url});
const headers = (await instance(`/`, {
const headers = (await instance('/', {
json: true
})).body;
t.is(headers.unicorn, 'rainbow');
Expand Down
2 changes: 1 addition & 1 deletion test/socket-destroyed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import got from '../source';
const {Timer} = process.binding('timer_wrap');

test.serial('clear the progressInterval if the socket has been destroyed', async t => {
const error = await t.throwsAsync(got(`http://127.0.0.1:55555`, {retry: 0}));
const error = await t.throwsAsync(got('http://127.0.0.1:55555', {retry: 0}));
const progressIntervalTimer = process._getActiveHandles().filter(handle => {
// Check if the handle is a Timer that matches the `uploadEventFrequency` interval
return handle instanceof Timer && handle._list.msecs === 150;
Expand Down
30 changes: 15 additions & 15 deletions test/timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ const keepAliveAgent = new http.Agent({
test.before('setup', async () => {
[s, ss] = await Promise.all([createServer(), createSSLServer()]);

s.on('/', async (request, response) => {
s.on('/', (request, response) => {
request.on('data', () => {});
request.on('end', async () => {
await delay(requestDelay);
response.end('OK');
});
});

s.on('/download', async (request, response) => {
s.on('/download', (request, response) => {
response.writeHead(200, {
'transfer-encoding': 'chunked'
});
Expand All @@ -59,7 +59,7 @@ test.before('setup', async () => {
response.end('OK');
});

ss.on('/', async (request, response) => {
ss.on('/', (request, response) => {
response.end('OK');
});

Expand All @@ -74,7 +74,7 @@ test('timeout option (ETIMEDOUT)', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'request' for 0ms`
message: 'Timeout awaiting \'request\' for 0ms'
}
);
});
Expand All @@ -87,7 +87,7 @@ test('timeout option as object (ETIMEDOUT)', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'request' for 1ms`
message: 'Timeout awaiting \'request\' for 1ms'
}
);
});
Expand All @@ -114,7 +114,7 @@ test('send timeout', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'send' for 1ms`
message: 'Timeout awaiting \'send\' for 1ms'
}
);
});
Expand All @@ -131,13 +131,13 @@ test('send timeout (keepalive)', async t => {
request.once('socket', socket => {
t.false(socket.connecting);
socket.once('connect', () => {
t.fail(`'connect' event fired, invalidating test`);
t.fail('\'connect\' event fired, invalidating test');
});
});
}),
{
...errorMatcher,
message: `Timeout awaiting 'send' for 1ms`
message: 'Timeout awaiting \'send\' for 1ms'
}
);
});
Expand All @@ -150,7 +150,7 @@ test('response timeout', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'response' for 1ms`
message: 'Timeout awaiting \'response\' for 1ms'
}
);
});
Expand Down Expand Up @@ -193,13 +193,13 @@ test('response timeout (keepalive)', async t => {
request.once('socket', socket => {
t.false(socket.connecting);
socket.once('connect', () => {
t.fail(`'connect' event fired, invalidating test`);
t.fail('\'connect\' event fired, invalidating test');
});
});
});
await t.throwsAsync(request, {
...errorMatcher,
message: `Timeout awaiting 'response' for 1ms`
message: 'Timeout awaiting \'response\' for 1ms'
});
});

Expand Down Expand Up @@ -227,7 +227,7 @@ test('connect timeout', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'connect' for 1ms`
message: 'Timeout awaiting \'connect\' for 1ms'
}
);
});
Expand All @@ -248,7 +248,7 @@ test('connect timeout (ip address)', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'connect' for 1ms`
message: 'Timeout awaiting \'connect\' for 1ms'
}
);
});
Expand All @@ -262,7 +262,7 @@ test('secureConnect timeout', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'secureConnect' for 1ms`
message: 'Timeout awaiting \'secureConnect\' for 1ms'
}
);
});
Expand Down Expand Up @@ -294,7 +294,7 @@ test('lookup timeout', async t => {
}),
{
...errorMatcher,
message: `Timeout awaiting 'lookup' for 1ms`
message: 'Timeout awaiting \'lookup\' for 1ms'
}
);
});
Expand Down

0 comments on commit 9c50d26

Please sign in to comment.