0

The following command works as expected:

protractor --cucumberOpts.tags='not @tag1' conf.js

Now I want to add this command as a script to package.json like this:

"scripts": {
    "my-script": "protractor --cucumberOpts.tags='not @tag1' conf.js"
}

Running the command npm run my-script gives me the following error:

Usage: protractor [configFile] [options]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
See the reference config for a full list of options.

Options:
  ...

Error: Error: more than one config file specified

Why is that?

Both of the commands seem to be identical.

sininen
  • 503
  • 1
  • 6
  • 20
  • Possible duplicate of [single quotes not working in package.json](https://stackoverflow.com/questions/48104380/single-quotes-not-working-in-package-json) – DublinDev Apr 02 '19 at 18:20
  • I flagged this as a duplicate but can understand how the root cause was not easy to spot – DublinDev Apr 02 '19 at 18:24

1 Answers1

1

This is not actually a protractor issue. I was able to recreate this issue and resolved it by using escaped doubles quotes in that script string like so.

"scripts": {
    "my-script": "protractor --cucumberOpts.tags=\"not @tag1\" conf.js"
}

This issue (apparently) is to do with how node handles single quotes on different operating systems. There is some more info in this question.

DublinDev
  • 2,318
  • 2
  • 8
  • 31