在这里,我的预期行为就像我想将动态字符串值传递给 npm 脚本。我的 npm 脚本文件是:
{
"scripts": {
"buildId": "node ./getBuildId.js",
"parallel": "CYPRESS_API_URL='http://localhost:1234/' cy2 run --record --parallel --config video=false --key sofy-automation --ci-build-id sofy-automation-parallel",
}
}
所以,--ci-build-id每次都需要是一个动态字符串。我创建了一个 js 文件,它会给我一个动态字符串值,但是如何将该值传递给我在--ci-build-id之后的下一个命令
这是我的getBuildId.js
文件。
const buildTimestamp = `sofy-automation-parallel-${new Date().getTime()}`
console.log(buildTimestamp)
我不确定不创建新文件是否可行。我的预期行为只是在npm script中传递动态 --ci-build-id 值。