diff --git a/lib/parallel_cucumber/runtime.js b/lib/parallel_cucumber/runtime.js index 79d5213..c0c9a0a 100644 --- a/lib/parallel_cucumber/runtime.js +++ b/lib/parallel_cucumber/runtime.js @@ -225,34 +225,39 @@ var Runtime = function (configuration) { self._getFeatureFileObjects(featureFilePath).forEach(function (featureFile) { Object.keys(options.profiles).forEach(function (profileName) { var profile = options.profiles[profileName]; - // Clone the array using slice() - var tags = profile.tags ? profile.tags.slice() : []; + // If profile.tags is defined and not empty than split tags string into array + var tags = profile.tags && profile.tags[0] ? profile.tags[0].split(',') : []; var env = profile.env || {}; env.PARALLEL_CUCUMBER_PROFILE = profileName; + function addTask() { + tasks.push({ + taskIndex: taskCount++, + profileName: profileName, + featureFilePath: featureFile.path, + supportCodePaths: options.supportCodePaths, + tags: profile.tags || [], + env: env, + retryCount: 0 + }); + } + var matchTags = true; - tags.forEach(function (tag) { - if (matchTags) { + if (tags.length === 0) { + addTask(); + } else { + tags.forEach(function (tag) { if (tag.indexOf('~') === 0) { matchTags = featureFile.tags.indexOf(tag.substring(1)) === -1; } else { matchTags = featureFile.tags.indexOf(tag) > -1; } - } - }); - if (matchTags) { - var task = { - taskIndex: taskCount++, - profileName: profileName, - featureFilePath: featureFile.path, - supportCodePaths: options.supportCodePaths, - tags: tags, - env: env, - retryCount: 0 - }; - tasks.push(task); + if (matchTags) { + addTask(); + } + }); } }); });