Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2021-03-25 07:20:19 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-26 00:31:58 +0300
commit59cf37962a2286e0f7d3bd37fa9c8bc3bac94218 (patch)
treeb155773999e00c92cb8a17a0d80d947ae820c52a /test
parent95ba87622e00d68270eda9e071b19737718fca16 (diff)
Always set npm.command to canonical command nameisaacs/set-npm-command-to-canonical-command
This ensures that we get a npm_command env set to, eg 'run-script' instead of the shorthand 'run'. PR-URL: https://github.com/npm/cli/pull/2958 Credit: @isaacs Close: #2958 Reviewed-by: @wraithgar
Diffstat (limited to 'test')
-rw-r--r--test/lib/npm.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/lib/npm.js b/test/lib/npm.js
index 573919398..4d40792af 100644
--- a/test/lib/npm.js
+++ b/test/lib/npm.js
@@ -15,7 +15,7 @@ for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e))) {
'should match "npm test" or "npm run test"'
)
} else
- t.match(process.env[env], /^(run)|(run-script)|(exec)$/)
+ t.match(process.env[env], /^(run-script|exec)$/)
}
delete process.env[env]
}
@@ -411,10 +411,15 @@ t.test('npm.load', t => {
npm.localPrefix = dir
await new Promise((res, rej) => {
- npm.commands['run-script']([], er => {
+ // verify that calling the command with a short name still sets
+ // the npm.command property to the full canonical name of the cmd.
+ npm.command = null
+ npm.commands.run([], er => {
if (er)
rej(er)
+ t.equal(npm.command, 'run-script', 'npm.command set to canonical name')
+
t.match(
consoleLogs,
[