diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index 85d13762eef67..245b9170d56fc 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -60,7 +60,7 @@ const buildOmitList = obj => { const editor = process.env.EDITOR || process.env.VISUAL || - (isWindows ? 'notepad.exe' : 'vi') + (isWindows ? `${process.env.SYSTEMROOT}\\notepad.exe` : 'vi') const shell = isWindows ? process.env.ComSpec || 'cmd' : process.env.SHELL || 'sh' @@ -628,8 +628,8 @@ define('dry-run', { define('editor', { default: editor, defaultDescription: ` - The EDITOR or VISUAL environment variables, or 'notepad.exe' on Windows, - or 'vim' on Unix systems + The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\\notepad.exe' on Windows, + or 'vi' on Unix systems `, type: String, description: ` diff --git a/tap-snapshots/test/lib/docs.js.test.cjs b/tap-snapshots/test/lib/docs.js.test.cjs index b1b7d5b6b493e..3c6a1b5025989 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -874,8 +874,8 @@ Note: This is NOT honored by other network related commands, eg \`dist-tags\`, #### \`editor\` -* Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on - Windows, or 'vim' on Unix systems +* Default: The EDITOR or VISUAL environment variables, or + '%SYSTEMROOT%\\notepad.exe' on Windows, or 'vi' on Unix systems * Type: String The command to run for \`npm edit\` and \`npm config edit\`. diff --git a/test/lib/utils/config/definitions.js b/test/lib/utils/config/definitions.js index 21eba1617affd..da53ac3aea03f 100644 --- a/test/lib/utils/config/definitions.js +++ b/test/lib/utils/config/definitions.js @@ -33,9 +33,15 @@ t.test('editor', t => { t.end() }) t.test('has neither EDITOR nor VISUAL, system specific', t => { - mockGlobals(t, { 'process.env': { EDITOR: undefined, VISUAL: undefined } }) + mockGlobals(t, { + 'process.env': { + EDITOR: undefined, + VISUAL: undefined, + SYSTEMROOT: 'C:\\Windows', + }, + }) const defsWin = mockDefs(isWin(true)) - t.equal(defsWin.editor.default, 'notepad.exe') + t.equal(defsWin.editor.default, 'C:\\Windows\\notepad.exe') const defsNix = mockDefs(isWin(false)) t.equal(defsNix.editor.default, 'vi') t.end()