【问题标题】:Can node modules read protractor parameters?节点模块可以读取量角器参数吗?
【发布时间】:2018-11-30 01:22:11
【问题描述】:

节点模块是否可以读取量角器参数?我需要在量角器 conf.js 中设置一个参数,并且只运行节点模块 js 文件的特定部分,该文件在 5 个项目之间共享。

例如在我的conf.js

exports.config = {
    runtime:'default'
}

我想打电话给protractor conf.js --runtime docker

在我的 node_modules 中,我有一个 if 条件:

if(browser.runtime==='docker') {
  //do something
} 

我想在我创建的节点模块内访问量角器命令行调用中的runtime 参数集。反正有这样做吗?

【问题讨论】:

  • ... only run a particular part of the node_modules 是什么意思?我不明白你的意思。
  • particular part of the node module js 是否意味着量角器specs' (test cases)? If so, you can group them into different suite in suites, and execute as protractor conf.js --suite=groupA`
  • 用更多细节更新了问题@yong
  • 用更多细节更新了问题@Batajus

标签: javascript node.js angular protractor node-modules


【解决方案1】:

我想通了。

要让其他文件在量角器中使用命令行参数,它们必须在params 配置中定义,而不是在其他任何地方。

exports.config = {
    params: { 
         runtime : 'default'
    }
}

然后我可以protractor conf.js --params.runtime docker 并在我的节点模块中以browser.params.runtime 的身份访问它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-14
    • 1970-01-01
    • 2014-04-08
    • 1970-01-01
    • 1970-01-01
    • 2016-11-20
    • 2019-07-31
    • 2021-05-01
    相关资源
    最近更新 更多