【发布时间】:2021-05-06 13:58:01
【问题描述】:
我在 Azure Devops Pipelines 中使用 NPM 运行任务。我想将 Azure 预定义变量传递到我的 package.json。
例如:npm run cypresstask
这样我就可以将其作为“cypress run --ci-build-id”的参数传递
【问题讨论】:
标签: npm azure-devops cypress
我在 Azure Devops Pipelines 中使用 NPM 运行任务。我想将 Azure 预定义变量传递到我的 package.json。
例如:npm run cypresstask
这样我就可以将其作为“cypress run --ci-build-id”的参数传递
【问题讨论】:
标签: npm azure-devops cypress
在您的 package.json 文件中,您可以在脚本中编写命令:
"scripts": {
"test": "cypress run --ci-build-id"
}
在你的 yml 文件中你可以使用:
npm test
【讨论】:
回答我自己的问题:
NPM 运行任务命令: 运行 cypress:ci --azbuildid=$(Build.BuildNumber)
然后在 package.json 中,您可以将其提供为 赛普拉斯运行 --ci-build-id $npm_config_azbuildid
所以你用 -- 设置参数。使用 $() 提供预定义变量并使用 $npm_config_ 在 package.json 中访问它们
【讨论】: