Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Ido Shamun <idoesh1@gmail.com>
Jason Dobry <jason.dobry@gmail.com>
Jesse Friedman <jesse@jesse.ws>
Johan Euphrosine <proppy@google.com>
Nathan White <nw@nwhite.net>
Marco Ziccardi <marco.ziccard@gmail.com>
Patrick Costello <pcostell@google.com>
Silvano Luciani <silvano@google.com>
Expand Down
4 changes: 4 additions & 0 deletions packages/common/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/common/test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down