From 12c1ad04db972bbb40d49c952f8f8da6871c7216 Mon Sep 17 00:00:00 2001 From: Qix Date: Thu, 31 Mar 2022 17:24:37 +0200 Subject: [PATCH 1/6] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 58 +++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 58858535..f674f400 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,28 +1,38 @@ From d1616622e4d404863c5a98443f755b4006e971dc Mon Sep 17 00:00:00 2001 From: Qix Date: Thu, 31 Mar 2022 17:43:51 +0200 Subject: [PATCH 2/6] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index f674f400..62c47e32 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,11 +1,12 @@ diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index af3da470..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,17 +0,0 @@ - From cac39b1c5b018b0fe93a53a05f084eee543d17f5 Mon Sep 17 00:00:00 2001 From: calvintwr Date: Fri, 31 May 2024 19:34:49 +0800 Subject: [PATCH 4/6] Fix/debug depth (#926) * fix debug format options ignored * moved sinon to devDependencies --- package.json | 3 ++- src/node.js | 4 ++-- test.node.js | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 test.node.js diff --git a/package.json b/package.json index 3bcdc242..5da3cfeb 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "scripts": { "lint": "xo", "test": "npm run test:node && npm run test:browser && npm run lint", - "test:node": "istanbul cover _mocha -- test.js", + "test:node": "istanbul cover _mocha -- test.js test.node.js", "test:browser": "karma start --single-run", "test:coverage": "cat ./coverage/lcov.info | coveralls" }, @@ -44,6 +44,7 @@ "karma-mocha": "^1.3.0", "mocha": "^5.2.0", "mocha-lcov-reporter": "^1.2.0", + "sinon": "^14.0.0", "xo": "^0.23.0" }, "peerDependenciesMeta": { diff --git a/src/node.js b/src/node.js index 79bc085c..715560a4 100644 --- a/src/node.js +++ b/src/node.js @@ -187,11 +187,11 @@ function getDate() { } /** - * Invokes `util.format()` with the specified arguments and writes to stderr. + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. */ function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); } /** diff --git a/test.node.js b/test.node.js new file mode 100644 index 00000000..4cc3c051 --- /dev/null +++ b/test.node.js @@ -0,0 +1,40 @@ +/* eslint-env mocha */ + +const assert = require('assert'); +const util = require('util'); +const sinon = require('sinon'); +const debug = require('./src/node'); + +const formatWithOptionsSpy = sinon.spy(util, 'formatWithOptions'); +beforeEach(() => { + formatWithOptionsSpy.resetHistory(); +}); + +describe('debug node', () => { + describe('formatting options', () => { + it('calls util.formatWithOptions', () => { + debug.enable('*'); + const stdErrWriteStub = sinon.stub(process.stderr, 'write'); + const log = debug('formatting options'); + log('hello world'); + assert(util.formatWithOptions.callCount === 1); + stdErrWriteStub.restore(); + }); + + it('calls util.formatWithOptions with inspectOpts', () => { + debug.enable('*'); + const options = { + hideDate: true, + colors: true, + depth: 10, + showHidden: true + }; + Object.assign(debug.inspectOpts, options); + const stdErrWriteStub = sinon.stub(process.stderr, 'write'); + const log = debug('format with inspectOpts'); + log('hello world2'); + assert.deepStrictEqual(util.formatWithOptions.getCall(0).args[0], options); + stdErrWriteStub.restore(); + }); + }); +}); From f244ada2e98b30a09b42e6f85e8d4ac3f038d2d6 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Fri, 31 May 2024 13:37:01 +0200 Subject: [PATCH 5/6] update authorship contact info --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5da3cfeb..f498861c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "LICENSE", "README.md" ], - "author": "Josh Junon ", + "author": "Josh Junon (https://github.com/qix-)", "contributors": [ "TJ Holowaychuk ", "Nathan Rajlich (http://n8.io)", From 5464bdddbc6f91b2aef2ad20650d3a6cfd9fcc3a Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Fri, 31 May 2024 13:37:42 +0200 Subject: [PATCH 6/6] 4.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f498861c..cb671038 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "debug", - "version": "4.3.4", + "version": "4.3.5", "repository": { "type": "git", "url": "git://github.com/debug-js/debug.git"