【问题标题】:Can we change the cypress.env.json file name我们可以更改 cypress.env.json 文件名吗
【发布时间】:2021-12-17 14:15:18
【问题描述】:

我想为生产环境和非生产环境使用不同的环境变量文件。目前我正在为所有环境维护一个文件,并且每个环境文件内容将根据环境而有所不同。因此有可能根据环境重命名文件并在运行时传递它或在配置文件(cypress.json)中定义相应的环境文件

示例环境文件名: cypress.env.nonprod.json cypress.env.prod.json

【问题讨论】:

    标签: json typescript testing automation cypress


    【解决方案1】:

    您可以在项目根目录中创建 cypress 配置文件。例如,如果您有三个配置文件:

    • production.json
    • staging.json
    • dev.json

    然后根据你要使用什么配置文件,直接运行命令即可:

    npx cypress run --config-file staging.json
    

    【讨论】:

      猜你喜欢
      • 2011-04-14
      • 1970-01-01
      • 2012-01-17
      • 2011-09-13
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      • 1970-01-01
      • 2013-04-15
      相关资源
      最近更新 更多