Skip to content

Commit

Permalink
Fix tests on Node.js 12
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 24, 2019
1 parent e2054cd commit bf1aa54
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
@@ -1,5 +1,6 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
after_success:
Expand Down
4 changes: 3 additions & 1 deletion test/redirects.ts
Expand Up @@ -253,7 +253,9 @@ test('throws on invalid redirect URL', withServer, async (t, server, got) => {
});
});

test('port is reset on redirect', withServer, async (t, server, got) => {
// TODO: Enable this again when https://github.com/nock/nock/issues/1509 is fixed
// eslint-disable-next-line ava/no-skip-test
test.skip('port is reset on redirect', withServer, async (t, server, got) => {
server.get('/', (_request, response) => {
response.writeHead(307, {
location: 'http://localhost'
Expand Down
9 changes: 5 additions & 4 deletions test/socket-destroyed.ts
@@ -1,12 +1,13 @@
import test from 'ava';
import got from '../source';

// TODO: Use `getActiveResources()` instead when it's out:
// TODO: Use `getActiveResources()` instead of `process.binding('timer_wrap')` when it's out:
// https://github.com/nodejs/node/pull/21453
// @ts-ignore
const {Timer} = process.binding('timer_wrap'); // eslint-disable-line node/no-deprecated-api
// eslint-disable-next-line ava/no-skip-test
test.skip('clear the progressInterval if the socket has been destroyed', async t => {
// @ts-ignore
const {Timer} = process.binding('timer_wrap'); // eslint-disable-line node/no-deprecated-api

test('clear the progressInterval if the socket has been destroyed', async t => {
await t.throwsAsync(got('http://127.0.0.1:55555', {retry: 0}), {
code: 'ECONNREFUSED'
});
Expand Down
2 changes: 1 addition & 1 deletion test/unix-socket.ts
Expand Up @@ -34,7 +34,7 @@ if (process.platform !== 'win32') {
test('throws on invalid URL', async t => {
await t.throwsAsync(got('unix:'), {
instanceOf: got.RequestError,
message: 'getaddrinfo ENOTFOUND unix unix:80'
code: 'ENOTFOUND'
});
});
}

0 comments on commit bf1aa54

Please sign in to comment.