Skip to content

Commit

Permalink
Adding test for npm#2949
Browse files Browse the repository at this point in the history
Testing with the path returned from glob() on my Windows system. The current release attempts to open this URL:

file://C:\Program Files\node-v14.15.5-win-x64\node_modules\npm\docs\output\15\npm-install.html

which, odd-looking slash conventions aside, is in the wrong section.
  • Loading branch information
dmchurch committed Mar 24, 2021
1 parent c546250 commit 2c48402
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/lib/help.js
Expand Up @@ -340,3 +340,26 @@ test('npm help - man viewer propagates errors', t => {
t.end()
})
})

test('npm help with complex installation path finds proper help file', t => {
npmConfig.viewer = 'browser'
globResult = [
'C:/Program Files/node-v14.15.5-win-x64/node_modules/npm/man/man1/npm-install.1',
// glob always returns forward slashes, even on Windows
]

t.teardown(() => {
npmConfig.viewer = undefined
globResult = globDefaults
spawnBin = null
spawnArgs = null
})

return help.exec(['1', 'install'], (err) => {
if (err)
throw err

t.match(openUrlArg, /commands(\/|\\)npm-install.html$/, 'attempts to open the correct url')
t.end()
})
})

0 comments on commit 2c48402

Please sign in to comment.