Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Pass through all grunt options to protractor #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 11 additions & 6 deletions tasks/protractor_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ module.exports = function(grunt) {

// Iterate over all supported arguments.
strArgs.forEach(function(a) {
if (a in opts.args || grunt.option(a)) {
args.push('--'+a, grunt.option(a) || opts.args[a]);
if (a in opts.args) {
args.push('--'+a, opts.args[a]);
}
});
listArgs.forEach(function(a) {
if (a in opts.args || grunt.option(a)) {
args.push('--'+a, grunt.option(a) || opts.args[a].join(","));
if (a in opts.args) {
args.push('--'+a, opts.args[a].join(","));
}
});
boolArgs.forEach(function(a) {
if (a in opts.args || grunt.option(a)) {
if (a in opts.args) {
args.push('--'+a);
}
});
Expand Down Expand Up @@ -110,9 +110,14 @@ module.exports = function(grunt) {
args.push(prefix+"."+key, val);
}
}
})("--" + a, grunt.option(a) || opts.args[a], args);
})("--" + a, opts.args[a], args);
});

// Pass any remaining grunt options to protractor verbatim.
//
// This allows for adding to Object-flavored arguments, and for overriding
// any other flavor of arguments, via the command line.
args = args.concat(grunt.option.flags());

// Spawn protractor command
var done = this.async();
Expand Down
5 changes: 2 additions & 3 deletions test/objectArgs_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ var exec = require('child_process').execSync,
runnerStdOut;

exports.testCucumberOpts = function (test) {
var cmd = 'grunt protractor:testTargetConfigFile --cucumberOpts={\\"tags\\":\\"@quick\\"} --verbose',
var cmd = 'grunt protractor:testTargetConfigFile --cucumberOpts.tags=@quick --verbose',
testDone = false;

runnerStdOut = exec(cmd)
if (typeof runnerStdOut === 'object'){
runnerStdOut = runnerStdOut.toString();
}
if (runnerStdOut.indexOf('Spawn node with arguments:') > -1 && runnerStdOut.indexOf('--cucumberOpts.tags @quick') > -1) {
if (runnerStdOut.indexOf('Spawn node with arguments:') > -1 && runnerStdOut.indexOf('--cucumberOpts.tags=@quick') > -1) {
test.ok(true, 'CucumberOpts test passed!')
test.done();
} else {
test.ok(false, 'Could not find cucumberOpts')
test.done();
}
};