我们可以从测试中动态地更改helper配置选项吗?我看到了动态配置设置,给出了下面的命令
npx codeceptjs run --override '{ "helpers": {"Protractor": {"browser": "firefox"}}}'但是当我运行的时候,我得到了下面的错误
undefined:1
{helpers:
^
SyntaxError: Unexpected token h in JSON at position 1
at JSON.parse (<anonymous>)
at Command.module.exports (D:\Finlevit_Codecept_Cucumber\node_modules\codeceptjs\lib\command\run.js:21:33)
at Command.listener (D:\Finlevit_Codecept_Cucumber\node_modules\commander\index.js:315:8)
at Command.emit (events.js:311:20)
at Command.parseArgs (D:\Finlevit_Codecept_Cucumber\node_modules\commander\index.js:651:12)
at Command.parse (D:\Finlevit_Codecept_Cucumber\node_modules\commander\index.js:474:21)
at Object.<anonymous> (D:\Finlevit_Codecept_Cucumber\node_modules\codeceptjs\bin\codecept.js:228:9)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)有人能帮我吗?
发布于 2020-04-16 23:38:25
看起来您使用的是带有CMD工具的Windows。
该工具可以处理双引号中的字符串。别忘了用\"转义JSON双引号
npx codeceptjs run --override "{ \"helpers\": {\"Protractor\": {\"browser\": \"firefox\"}}}"或者,您可以尝试使用shell/linux builder。
https://stackoverflow.com/questions/61193414
复制相似问题