Registry / testing / supertest-with-proxy

supertest-with-proxy

JSON →
library5.0.2jsnpmunverified

supertest-with-proxy is a specialized wrapper around the popular `supertest` library, designed to facilitate testing HTTP servers that require proxy configurations. It extends `supertest`'s capabilities by enabling the specification of an HTTP proxy for test requests, a common requirement in enterprise or complex network environments. The current stable version is 5.0.2. This package appears to be abandoned, with its last publish occurring over six years ago, meaning there are no active releases or maintenance, and its compatibility with modern Node.js or `supertest` versions is uncertain. Its key differentiator was providing direct proxy integration, which standard `supertest` does not offer out-of-the-box, simplifying testing for proxy-aware applications with a familiar, chainable API.

npm install supertest-with-proxy
INSTALL
IMPORT
SIG · SUPERTEST-WITH-PRO
S
supertest-with-proxy
testingjavascriptv5.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

request
const request = require('supertest-with-proxy');
import request from 'supertest-with-proxy';
This library is primarily CommonJS (CJS). ESM import syntax will lead to errors.
request
const request = require('supertest-with-proxy');
const { request } = require('supertest-with-proxy');
The library exports a single function as its default, not named exports. Destructuring will result in an undefined 'request'.
request
const request = require('supertest-with-proxy');
import { request } from 'supertest-with-proxy';
Incorrect usage for both CJS-only package and trying to import a non-existent named export.

This example demonstrates how to use `supertest-with-proxy` to test an Express.js application's `/user` endpoint, routing the request through a specified proxy server and asserting the response.

const request = require('supertest-with-proxy'); const express = require('express'); const app = express(); app.get('/user', function(req, res) { res.status(200).json({ name: 'john' }); }); request(app) .get('/user') .proxy('http://example.com') .expect('Content-Type', /json/) .expect('Content-Length', '15') .expect(200) .end(function(err, res) { if (err) throw err; console.log('Test passed for user endpoint with proxy.'); });
Debug
Known issues
breakingThe package has not been updated in over six years and is considered abandoned. This means no new features, bug fixes, or security patches will be released, potentially leading to critical vulnerabilities or incompatibility with modern environments.
fix
Consider migrating to actively maintained alternatives or implementing proxy logic directly within standard `supertest` setups (e.g., using global-agent or a custom `superagent` wrapper).
affects: >=5.0.2
gotchaThe `engines.node` field specifies `>=6.0.0`, which is an extremely old Node.js version. Running this package on recent Node.js versions (e.g., Node.js 16, 18, 20+) may lead to unexpected behavior or runtime errors due to breaking changes in Node.js itself.
fix
Thoroughly test on your target Node.js version. Be prepared for potential compatibility issues and consider alternative proxy solutions for `supertest`.
affects: >=5.0.2
gotchaThe package's README points to a specific fork of `supertest` (`tauheedkhan/supertest` or `soniajasuja/supertest`) rather than the official, actively maintained `supertest` package. This suggests it might be tightly coupled to an older or specific `supertest` version, leading to potential API inconsistencies or a lack of support for features introduced in newer `supertest` releases.
fix
Verify compatibility with the `supertest` version you intend to use. If issues arise, you might be forced to downgrade `supertest` or explore alternative proxy integration methods for testing.
affects: >=5.0.2
Errors
Common errors & fixes
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".js" for /path/to/node_modules/supertest-with-proxy/index.js
Attempting to import a CommonJS-only package using ES Module `import` syntax in an ESM project.
fix
Change `import request from 'supertest-with-proxy';` to `const request = require('supertest-with-proxy');`.
supertest-with-proxy is not a function
This error can occur if `require('supertest-with-proxy')` returns `undefined` or an unexpected value, often due to Node.js version incompatibility or an issue during module loading.
fix
Ensure your Node.js version is compatible (though old versions are specified, newer ones might break it). Reinstall the package (`npm install supertest-with-proxy`) to rule out corrupted node_modules. Check for conflicting dependencies or global Node.js module issues.
Upgrade
Version history
5.0.2latest on npm
Audit
Dependencies
supertestrequiredThis package is a wrapper/extension for `supertest`, providing its core HTTP testing functionality.
superagentrequired`supertest` itself is built upon `superagent` for making HTTP requests, making this an indirect but critical dependency.
Agent activity
19 hits · last 30 days
node
14
OpenAI (training)
1
Resources
supertest-with-proxy — npm install supertest-with-proxy · libregistry