TestCafe:导出命令在 Linux 中不起作用

TestCafe: export command is not working in Linux

我正在使用 testcafe 进行自动化。

根据文档设置环境变量 我在本地使用 set 进行 windows 运行 测试,export 使用 Jenkins 作业在 Linux 环境中进行 运行 测试。 在 windows 中,它工作得很好。但是在 Linux export 命令中没有设置环境变量。

我在windowsset ENV=staging& npx testcafe \"chrome:headless --no-sandbox --disable-dev-shm-usage\" automation_suite/tests

中使用的shell命令

我在 Jenkins 中使用的 shell 脚本命令到 Linux 上的 运行 Jenkins 管道脚本

  stage('Run tests') {
   steps {
    sh 'npm run ci360:smoketest:chrome:headless'
   }
  }

shell命令

npm run ci360:smoketest:chrome:headless 会自动调用命令

export ENV=staging& npx testcafe \"chrome:headless --no-sandbox --disable-dev-shm-usage\" automation_suite/tests 在 package.json

的脚本部分定义

不确定这里有什么问题,我被困在了这一点上。感谢任何帮助。

问题已通过将 & 替换为 ;

得到解决