From 9dd2ed5189b6f283094664e9e192cf1598ec3f79 Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Mon, 29 Mar 2021 11:00:44 -0400 Subject: fix: empty newline printed to stderr Starting in v7.7.0 running `npm` (no args) is printing an empty newline to stderr. This fixes that by correctly exiting via errorHandler and avoiding hitting the cb() never called error and adds a test to make sure we avoid that regression moving forward. Fixes: https://github.com/nodejs/node/pull/37678#issuecomment-808734374 Co-authored-by: Gar --- tap-snapshots/smoke-tests-index.js-TAP.test.js | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tap-snapshots') diff --git a/tap-snapshots/smoke-tests-index.js-TAP.test.js b/tap-snapshots/smoke-tests-index.js-TAP.test.js index aa8977316..932799bc5 100644 --- a/tap-snapshots/smoke-tests-index.js-TAP.test.js +++ b/tap-snapshots/smoke-tests-index.js-TAP.test.js @@ -5,6 +5,43 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' +exports[`smoke-tests/index.js TAP npm (no args) > should have expected no args output 1`] = ` +npm + +Usage: + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + {CWD}/smoke-tests/index/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@7.7.5 {CWD} + +` + exports[`smoke-tests/index.js TAP npm diff > should have expected diff output 1`] = ` diff --git a/package.json b/package.json index v1.0.4..v1.1.1 100644 -- cgit v1.2.3