diff --git a/lib/configure.js b/lib/configure.js index 97dccc6db8..bcd8bb23ea 100644 --- a/lib/configure.js +++ b/lib/configure.js @@ -85,7 +85,7 @@ function configure (gyp, argv, callback) { 'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No' ) if (win) { - findVisualStudio(release.semver, gyp.opts.msvs_version, + findVisualStudio(release.semver, gyp.opts['msvs-version'], createConfigFile) } else { createPythonSymlink() diff --git a/lib/node-gyp.js b/lib/node-gyp.js index 21d12460c8..392a0ecfa6 100644 --- a/lib/node-gyp.js +++ b/lib/node-gyp.js @@ -60,7 +60,7 @@ proto.configDefs = { debug: Boolean, // 'build' directory: String, // bin make: String, // 'build' - msvs_version: String, // 'configure' + 'msvs-version': String, // 'configure' ensure: Boolean, // 'install' solution: String, // 'build' (windows only) proxy: String, // 'install' diff --git a/test/test-options.js b/test/test-options.js index 24e79c80a1..8d281db8e8 100644 --- a/test/test-options.js +++ b/test/test-options.js @@ -38,4 +38,13 @@ describe('options', function () { assert.strictEqual(g.opts['force-process-config'], 'true') }) + + it('options with msvs_version', () => { + process.env.npm_config_msvs_version = '2017' + + const g = gyp() + g.parseArgv(['rebuild']) // Also sets opts.argv. + + assert.strictEqual(g.opts['msvs-version'], '2017') + }) })