From 6578727b881e91f90893676bf8f428cdf08ba4be Mon Sep 17 00:00:00 2001 From: Ivan Motiienko <1161259+katsanva@users.noreply.github.com> Date: Tue, 30 Jan 2024 21:02:49 +0100 Subject: [PATCH] chore: removed unneeded modules --- package.json | 2 -- test/error.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f9155b49b..f635a9e21 100644 --- a/package.json +++ b/package.json @@ -95,8 +95,6 @@ "request": "^2.88.2", "sinon": "^17.0.1", "slow-stream": "0.0.4", - "socks": "^2.7.1", - "socks-proxy-agent": "^8.0.2", "tempy": "^3.1.0", "then-busboy": "^5.2.1", "tough-cookie": "^4.1.3", diff --git a/test/error.ts b/test/error.ts index d1192dd48..dc8b02d8d 100644 --- a/test/error.ts +++ b/test/error.ts @@ -4,11 +4,10 @@ import net from 'node:net'; import http from 'node:http'; import stream from 'node:stream'; import {pipeline as streamPipeline} from 'node:stream/promises'; +import {Agent} from 'node:https'; import test from 'ava'; import getStream from 'get-stream'; import is from '@sindresorhus/is'; -import {SocksProxyAgent} from 'socks-proxy-agent'; -import {SocksClientError} from 'socks'; import got, {RequestError, HTTPError, TimeoutError} from '../source/index.js'; import type Request from '../source/core/index.js'; import withServer from './helpers/with-server.js'; @@ -369,10 +368,17 @@ test('should wrap got cause', async t => { }); test('should wrap non-got cause', async t => { + class SocksProxyAgent extends Agent { + createConnection() { + throw new SocksClientError('oh no'); + } + } + class SocksClientError extends Error {} const error = await t.throwsAsync(got('https://github.com', {retry: {limit: 0}, timeout: {read: 1}, agent: {https: new SocksProxyAgent('socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com')}})); const cause = error?.cause as Error; t.is(error?.code, 'ERR_GOT_REQUEST_ERROR'); t.is(error?.message, cause.message); + t.is(error?.message, 'oh no'); t.assert(cause instanceof SocksClientError); });