diff --git a/lib/run/options.js b/lib/run/options.js index 19c876ce2..130870fe6 100644 --- a/lib/run/options.js +++ b/lib/run/options.js @@ -52,12 +52,21 @@ var _ = require('lodash'), */ extractModel = function (source, type) { source = source[type] || source; // extract object that holds variable. these usually come from cloud API + + if (_.isObject(source) && !source.values) { + // Check if the source is an object and doesn't have a "values" property + // If it's an object, unwrap it if needed + source = source.collection || source; + } + if (!_.isObject(source)) { return undefined; } // ensure we un-box the JSON if it comes from cloud-api or similar sources - !source.values && _.isObject(source[type]) && (source = source[type]); + if (!source.values && _.isObject(source[type])) { + source = source[type]; + } // we ensure that environment passed as array is converted to plain object. runtime does this too, but we do it // here for consistency of options passed to reporters