diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a3b3418ae4a..4f7c580a86a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -21,6 +21,7 @@ Ido Shamun Jason Dobry Jesse Friedman Johan Euphrosine +Nathan White Marco Ziccardi Patrick Costello Silvano Luciani diff --git a/packages/common/src/util.js b/packages/common/src/util.js index 2d7c7096c60..fd240a19a3a 100644 --- a/packages/common/src/util.js +++ b/packages/common/src/util.js @@ -541,6 +541,10 @@ function normalizeArguments(globalContext, localConfig, options) { var config = util.extendGlobalConfig(globalConfig, localConfig); + if (!config.projectId && config.project_id) { + config.projectId = config.project_id; + } + if (options.projectIdRequired !== false && !config.projectId) { throw util.missingProjectIdError; } diff --git a/packages/common/test/util.js b/packages/common/test/util.js index 4cf81399b3e..4ff5c0a2ad2 100644 --- a/packages/common/test/util.js +++ b/packages/common/test/util.js @@ -1216,6 +1216,22 @@ describe('common/util', function() { assert.strictEqual(config, fakeContext.config_); }); + describe('project_idNormalized', function() { + var fakeContextWithProjectUnderscoreId = { + config_: { + project_id: 'grapespaceship911' + } + }; + + it('should return projectId', function() { + var config; + var projectId = fakeContextWithProjectUnderscoreId.config_.project_id; + + config = util.normalizeArguments(fakeContextWithProjectUnderscoreId); + assert.strictEqual(config.projectId, projectId); + }); + }); + describe('projectIdRequired', function() { var defaultProjectId;