diff --git a/lib/commons/config.js b/lib/commons/config.js index a09b468..7d721fc 100644 --- a/lib/commons/config.js +++ b/lib/commons/config.js @@ -18,17 +18,10 @@ const getRequiredOption = (options, optionName) => { }; const getApiKey = ({ apiKey, token }) => { - let calculatedApiKey = apiKey; - if (!calculatedApiKey) { - calculatedApiKey = token; - if (!calculatedApiKey) { - throw new ReportPortalRequiredOptionError('apiKey'); - } else { - console.warn(`Option 'token' is deprecated. Use 'apiKey' instead.`); - } - } - - return calculatedApiKey; + if (apiKey) return apiKey; + if (!token) throw new ReportPortalRequiredOptionError('apiKey'); + console.warn(`Option 'token' is deprecated. Use 'apiKey' instead.`); + return token; }; const getClientConfig = (options) => {