diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c08a65d4..63c7e5435 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test - # - uses: codecov/codecov-action@v1 + # - uses: codecov/codecov-action@v2 # if: matrix.os == 'ubuntu-latest' && matrix.node-version == 16 # with: # fail_ci_if_error: true diff --git a/benchmark/index.ts b/benchmark/index.ts index 87ccf445d..41de63de3 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -118,7 +118,7 @@ suite.add('got - promise', { }).add('node-fetch - promise', { defer: true, fn: async (deferred: {resolve: () => void}) => { - const response = await fetch(url, fetchOptions); + const response = await fetch(urlString, fetchOptions); await response.text(); deferred.resolve(); @@ -126,10 +126,10 @@ suite.add('got - promise', { }).add('node-fetch - stream', { defer: true, fn: async (deferred: {resolve: () => void}) => { - const {body} = await fetch(url, fetchOptions); + const {body} = await fetch(urlString, fetchOptions); - body.resume(); - body.once('end', () => { + body!.resume(); + body!.once('end', () => { deferred.resolve(); }); }, diff --git a/package.json b/package.json index 25b5425b7..b361e922c 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "cacheable-lookup": "^6.0.4", "cacheable-request": "^7.0.2", "decompress-response": "^6.0.0", - "form-data-encoder": "^1.6.0", + "form-data-encoder": "1.6.0", "get-stream": "^6.0.1", "http2-wrapper": "^2.1.9", "lowercase-keys": "^3.0.0", @@ -61,20 +61,19 @@ "devDependencies": { "@hapi/bourne": "^2.0.0", "@sindresorhus/tsconfig": "^2.0.0", - "@sinonjs/fake-timers": "^8.0.1", + "@sinonjs/fake-timers": "^8.1.0", "@types/benchmark": "^2.1.1", "@types/express": "^4.17.13", - "@types/node": "^16.11.3", - "@types/node-fetch": "^2.5.12", + "@types/node": "^16.11.7", "@types/pem": "^1.9.6", "@types/pify": "^5.0.1", "@types/readable-stream": "^2.3.11", "@types/request": "^2.48.7", - "@types/sinon": "^10.0.4", - "@types/sinonjs__fake-timers": "^6.0.4", + "@types/sinon": "^10.0.6", + "@types/sinonjs__fake-timers": "^8.1.0", "@types/tough-cookie": "^4.0.1", "ava": "^3.15.0", - "axios": "^0.23.0", + "axios": "^0.24.0", "benchmark": "^2.1.4", "bluebird": "^3.7.2", "body-parser": "^1.19.0", @@ -85,24 +84,24 @@ "express": "^4.17.1", "form-data": "^4.0.0", "formdata-node": "^4.3.1", - "nock": "^13.1.4", - "node-fetch": "^2.6.5", + "nock": "^13.2.1", + "node-fetch": "^3.1.0", "np": "^7.5.0", "nyc": "^15.1.0", - "p-event": "^4.2.0", + "p-event": "^5.0.1", "pem": "^1.14.4", "pify": "^5.0.0", "readable-stream": "^3.6.0", "request": "^2.88.2", - "sinon": "^11.1.2", + "sinon": "^12.0.1", "slow-stream": "0.0.4", "tempy": "^2.0.0", "then-busboy": "^5.1.1", "to-readable-stream": "^3.0.0", "tough-cookie": "^4.0.0", - "ts-node": "^10.3.1", - "typescript": "4.4.4", - "xo": "^0.45.0" + "ts-node": "^10.4.0", + "typescript": "4.5.2", + "xo": "^0.46.4" }, "types": "dist/source", "sideEffects": false, diff --git a/test/arguments.ts b/test/arguments.ts index badf78e5e..96bea4a0c 100644 --- a/test/arguments.ts +++ b/test/arguments.ts @@ -1,7 +1,7 @@ import {parse, URL, URLSearchParams} from 'url'; import test from 'ava'; import {Handler} from 'express'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import got, {Options, RequestError, StrictOptions} from '../source/index.js'; import withServer, {withBodyParsingServer} from './helpers/with-server.js'; import invalidUrl from './helpers/invalid-url.js'; diff --git a/test/cache.ts b/test/cache.ts index b83fb62f4..70e7d38a5 100644 --- a/test/cache.ts +++ b/test/cache.ts @@ -3,7 +3,7 @@ import {promisify} from 'util'; import {Agent} from 'http'; import {gzip} from 'zlib'; import test from 'ava'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import getStream from 'get-stream'; import {Handler} from 'express'; import nock from 'nock'; diff --git a/test/cancel.ts b/test/cancel.ts index 9331029dc..a31b9144d 100644 --- a/test/cancel.ts +++ b/test/cancel.ts @@ -3,7 +3,7 @@ import {EventEmitter} from 'events'; import stream, {Readable as ReadableStream} from 'stream'; import test from 'ava'; import delay from 'delay'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import getStream from 'get-stream'; import {Handler} from 'express'; import got, {CancelError, TimeoutError} from '../source/index.js'; @@ -187,7 +187,7 @@ test.serial('cancel immediately', withServerAndFakeTimers, async (t, server, got test('recover from cancelation using cancelable promise attribute', async t => { // Canceled before connection started const p = got('http://example.com'); - const recover = p.catch((error: Error) => { // eslint-disable-line promise/prefer-await-to-then + const recover = p.catch((error: Error) => { if (p.isCanceled) { return; } @@ -203,7 +203,7 @@ 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((error: Error) => { // eslint-disable-line promise/prefer-await-to-then + const recover = p.catch((error: Error) => { if (error instanceof CancelError) { return; } diff --git a/test/http.ts b/test/http.ts index 772e0b544..22bdc0b02 100644 --- a/test/http.ts +++ b/test/http.ts @@ -7,7 +7,7 @@ import test from 'ava'; import {Handler} from 'express'; import nock from 'nock'; import getStream from 'get-stream'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import got, {HTTPError, ReadError, RequestError} from '../source/index.js'; import withServer from './helpers/with-server.js'; diff --git a/test/https.ts b/test/https.ts index b8906c4ee..6df5e67ff 100644 --- a/test/https.ts +++ b/test/https.ts @@ -1,7 +1,7 @@ import process from 'process'; import tls, {DetailedPeerCertificate} from 'tls'; import test from 'ava'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import pify from 'pify'; import pem from 'pem'; import got from '../source/index.js'; diff --git a/test/post.ts b/test/post.ts index 164b61143..0290ebb9d 100644 --- a/test/post.ts +++ b/test/post.ts @@ -7,7 +7,7 @@ import fsPromises from 'fs/promises'; import path from 'path'; import test from 'ava'; import delay from 'delay'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import {Handler} from 'express'; import {parse, Body, BodyEntryPath, BodyEntryRawValue, isBodyFile} from 'then-busboy'; import {FormData as FormDataNode, Blob, File} from 'formdata-node'; diff --git a/test/retry.ts b/test/retry.ts index 9aed61a6c..5a82c551b 100644 --- a/test/retry.ts +++ b/test/retry.ts @@ -7,7 +7,7 @@ import test from 'ava'; import is from '@sindresorhus/is'; import {Handler} from 'express'; import getStream from 'get-stream'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import got, {HTTPError, TimeoutError} from '../source/index.js'; import Request from '../source/core/index.js'; import withServer from './helpers/with-server.js'; diff --git a/test/stream.ts b/test/stream.ts index 782cda54d..30c23ddcf 100644 --- a/test/stream.ts +++ b/test/stream.ts @@ -9,7 +9,7 @@ import test from 'ava'; import {Handler} from 'express'; import toReadableStream from 'to-readable-stream'; import getStream from 'get-stream'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import FormData from 'form-data'; import is from '@sindresorhus/is'; import delay from 'delay'; diff --git a/test/timeout.ts b/test/timeout.ts index 2265056c9..daa6b6580 100644 --- a/test/timeout.ts +++ b/test/timeout.ts @@ -9,7 +9,7 @@ import test from 'ava'; import delay from 'delay'; import CacheableLookup from 'cacheable-lookup'; import {Handler} from 'express'; -import pEvent from 'p-event'; +import {pEvent} from 'p-event'; import got, {RequestError, TimeoutError} from '../source/index.js'; import timedOut from '../source/core/timed-out.js'; import slowDataStream from './helpers/slow-data-stream.js';