diff options
author | Gar <gar+gh@danger.computer> | 2021-11-10 02:21:05 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-11-10 17:37:19 +0300 |
commit | cd6d3a90d4bbf3793834830b4c77fc8eb0846596 (patch) | |
tree | a1878ac35cd32d2483410a1214f3874709a87911 /test | |
parent | 7887fb3d7ba7f05abeb49dd92b76d90422cb38ca (diff) |
fix: explicitly allow `npm help` to open file:/// man pages
PR-URL: https://github.com/npm/cli/pull/4026
Credit: @wraithgar
Close: #4026
Reviewed-by: @isaacs
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/utils/open-url.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lib/utils/open-url.js b/test/lib/utils/open-url.js index cc63af129..1bf47d8bb 100644 --- a/test/lib/utils/open-url.js +++ b/test/lib/utils/open-url.js @@ -73,6 +73,18 @@ t.test('returns error for file url', async t => { t.same(OUTPUT, [], 'printed no output') }) +t.test('file url allowed if explicitly asked for', async t => { + t.teardown(() => { + openerUrl = null + openerOpts = null + OUTPUT.length = 0 + }) + await openUrl(npm, 'file:///man/page/npm-install', 'npm home', true) + t.equal(openerUrl, 'file:///man/page/npm-install', 'opened the given url') + t.same(openerOpts, { command: null }, 'passed command as null (the default)') + t.same(OUTPUT, [], 'printed no output') +}) + t.test('returns error for non-parseable url', async t => { t.teardown(() => { openerUrl = null |