Open arenevier opened 5 days ago
Would be happy to modify the tests. But I'm not sure what to modify. Also, running the tests hang on my laptop, after the following output:
% npm test
> proxy-chain@2.5.5 test
> nyc cross-env NODE_OPTIONS=--insecure-http-parser mocha --bail
(node:232095) Warning: Using insecure HTTP parsing
(Use `node --trace-warnings ...` to show where the warning was created)
✔ supports localAddress
✔ supports custom CONNECT server handler
✔ supports pre-response CONNECT payload
utils.anonymizeProxy
✔ throws for invalid args
✔ throws for unsupported https: protocol
✔ throws for invalid ports
✔ throws for invalid URLs
✔ keeps already anonymous proxies (both with callbacks and promises)
1) anonymizes authenticated upstream proxy (both with callbacks and promises)
8 passing (63ms)
1 failing
1) utils.anonymizeProxy
anonymizes authenticated upstream proxy (both with callbacks and promises):
AssertionError: expected 'socket hang up' to include 'ECONNREFUSED'
at /home/arno/src/proxy-chain/test/anonymize_proxy.js:236:48
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Would be happy to modify the tests. But I'm not sure what to modify. Also, running the tests hang on my laptop, after the following output:
% npm test > proxy-chain@2.5.5 test > nyc cross-env NODE_OPTIONS=--insecure-http-parser mocha --bail (node:232095) Warning: Using insecure HTTP parsing (Use `node --trace-warnings ...` to show where the warning was created) ✔ supports localAddress ✔ supports custom CONNECT server handler ✔ supports pre-response CONNECT payload utils.anonymizeProxy ✔ throws for invalid args ✔ throws for unsupported https: protocol ✔ throws for invalid ports ✔ throws for invalid URLs ✔ keeps already anonymous proxies (both with callbacks and promises) 1) anonymizes authenticated upstream proxy (both with callbacks and promises) 8 passing (63ms) 1 failing 1) utils.anonymizeProxy anonymizes authenticated upstream proxy (both with callbacks and promises): AssertionError: expected 'socket hang up' to include 'ECONNREFUSED' at /home/arno/src/proxy-chain/test/anonymize_proxy.js:236:48 at processTicksAndRejections (node:internal/process/task_queues:95:5)
Hey, for the tests, you can just see them run here in GitHub actions. If you're adding a test locally, you can just run the test you've added and will (hopefully) work in CI as well.
I added a test. I was not able to connect to a https server in the test. But in the test, I can check that proxyServer does not consider the relay url as invalid. The code snippet will fail without the PR, and pass with it.
Fix for issue #563