From a0a8702aeca0fed83f86815e2faf6a8d65942a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mence=20Mousset?= Date: Sun, 15 Jan 2023 19:13:39 +0100 Subject: [PATCH] Replace `debug` package by node:util.debuglog. Fixes #353 --- README.md | 3 ++- lib/needle.js | 2 +- package-lock.json | 8 -------- package.json | 1 - 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1adff8972..ece64155d 100644 --- a/README.md +++ b/README.md @@ -609,10 +609,11 @@ To run tests, you need to generate a self-signed SSL certificate in the `test` d $ openssl req -new -key test/keys/ssl.key -x509 -days 999 -out test/keys/ssl.cert Then you should be able to run `npm test` once you have the dependencies in place. +To run the tests with debug logs, set the environment variable `NODE_DEBUG` to `needle` (for example, by running `NODE_DEBUG=needle npm test`). > Note: Tests currently only work on linux-based environments that have `/proc/self/fd`. They *do not* work on MacOS environments. > You can use Docker to run tests by creating a container and mounting the needle project directory on `/app` -> `docker create --name Needle -v /app -w /app -v /app/node_modules -i node:argon` +> `docker create --name Needle -v $(pwd) -w /app -v $(pwd)/node_modules -i node:argon` Credits ------- diff --git a/lib/needle.js b/lib/needle.js index df5f1264f..3aa6cfef6 100644 --- a/lib/needle.js +++ b/lib/needle.js @@ -10,7 +10,7 @@ var fs = require('fs'), https = require('https'), url = require('url'), stream = require('stream'), - debug = require('debug')('needle'), + debug = require('util').debuglog('needle'), stringify = require('./querystring').build, multipart = require('./multipart'), auth = require('./auth'), diff --git a/package-lock.json b/package-lock.json index d19d745c6..807df82fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,14 +48,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", diff --git a/package.json b/package.json index 3303c264a..0e2b5da8d 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "url": "https://github.com/tomas/needle.git" }, "dependencies": { - "debug": "^3.2.6", "iconv-lite": "^0.6.3", "sax": "^1.2.4" },