量角器选项在 package.json 脚本中不起作用

Protractor option does not work in package.json script

以下命令按预期工作:

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

现在我想将此命令作为 script 添加到 package.json,如下所示:

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

运行 命令 npm run my-script 给我以下错误:

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

这是为什么?

这两个命令似乎是相同的。

这实际上不是量角器的问题。我能够重新创建此问题并通过在该脚本字符串中使用转义双引号来解决它。

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

这个问题(显然)与节点如何处理不同操作系统上的单引号有关。 问题中有更多信息。