我正在使用 Allure 报告进行 WebDriverIO mocha 测试自动化。报告生成工作正常,但是,在运行“alluregenerateallure-result”命令时开始显示以下错误。
allure :术语“allure”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。
行:1 字符:1
- 万能的诱惑
- CategoryInfo:ObjectNotFound:(魅力:字符串)[],CommandNotFoundException
- FullyQualifiedErrorId:CommandNotFoundException```
这是我的 package.json devDependency
"devDependencies": {
"@wdio/allure-reporter": "^7.16.11",
"@wdio/cli": "^7.16.13",
"@wdio/local-runner": "^7.16.13",
"@wdio/mocha-framework": "^7.16.13",
"@wdio/spec-reporter": "^7.16.13",
"chromedriver": "^97.0.2",
"mocha-allure-reporter": "^1.4.0",
"wdio-chromedriver-service": "^7.2.6"
},
失败的原因可能是什么以及如何处理?
运行:
npm install -g allure-commandline --save-dev
为我解决了问题。
参考:https://www.npmjs.com/package/allure-commandline
谢谢
伙计们,当我们遇到这个错误时,有两种方法可以纠正 第一种方式 100% 成功
接下来先安装powershell
在安装 scoop 的 powershell 命令提示符下运行这 2 个命令
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 调用 RestMethod -Uri https://get.scoop.sh |调用表达式 现在完成后运行其他命令来安装 allure 舀安装诱惑
现在使用 allure--version 检查 allure 版本
第二种方法是检查环境变量路径是否添加了魅力报告