fix: Make sure getLogTypes returns a promise
MODIFY
lib/basedriver/commands/log.js
lib/basedriver/commands/log.js
@@ -14,7 +14,8 @@ const commands = {}, helpers = {}, extensions = {};
// }
extensions.supportedLogTypes = {};
-commands.getLogTypes = function getLogTypes () {
+// eslint-disable-next-line require-await
+commands.getLogTypes = async function getLogTypes () {
log.debug('Retrieving supported log types');
return _.keys(this.supportedLogTypes);
};
@@ -22,10 +23,10 @@ commands.getLogTypes = function getLogTypes () {
commands.getLog = async function getLog (logType) {
log.debug(`Retrieving '${logType}' logs`);
- if (!this.getLogTypes().includes(logType)) {
- const logsTypesWithDescriptions = _.reduce(this.supportedLogTypes, function getDescriptions (result, value, key) {
- result[key] = value.description;
- return result;
+ if (!(await this.getLogTypes()).includes(logType)) {
+ const logsTypesWithDescriptions = _.reduce(this.supportedLogTypes, (acc, value, key) => {
+ acc[key] = value.description;
+ return acc;
}, {});
throw new Error(`Unsupported log type '${logType}'. ` +
`Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);

fix: Make sure getLogTypes returns a promise (#414)