gpt4 book ai didi

visual-studio-code - 在 visual studio 代码中调试 Protractor 测试时出现 cucumber 错误,但在运行模式下一切正常

转载 作者:行者123 更新时间:2023-12-04 03:00:19 25 4
gpt4 key购买 nike

我在“visual studio code”中对 Protractor cucumber 进行了基本设置,当我从终端运行它时一切正常。但是,当我通过 visual studio code 调试它时,它会给我版本错误。我没有在全局范围内安装 Cucumber。我通过本地目录中的 npm install 安装了它,但错误消息仍然说我保留了两个不同的版本。怎么可能?

此错误消息也应该在运行模式下出现,为什么它只在 Debug模式下出现。请看下面的错误。

[18:34:15] I/launcher - Running 1 instances of WebDriver
logger.js:158
[18:34:15] I/local - Starting selenium standalone server...
logger.js:158
[18:34:16] I/local - Selenium standalone server started at
http://10.12.2.155:60837/wd/hub
logger.js:158
Unhandled rejection Error:
debuggability.js:868

You appear to be executing an install of cucumber (most likely a global
install)
that is different from your local install (the one required in your support
files).
For cucumber to work, you need to execute the same install that is required
in your support files.
Please execute the locally installed version to run your tests.
Executed Path: D:\Prog Test\protractor-cucumber-
master\node_modules\cucumber\lib\index.js
Local Path: d:\Prog Test\protractor-cucumber-
master\node_modules\cucumber\lib\index.js

at D:\Prog Test\protractor-cucumber-
master\node_modules\cucumber\src\cli\install_validator.js:17:11
at Generator.next ()
at Generator.tryCatcher (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\util.js:16:23)
at PromiseSpawn._promiseFulfilled (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\generators.js:97:49)
at Promise._settlePromise (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\promise.js:574:26)
at Promise._settlePromise0 (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\promise.js:693:18)
at Async._drainQueue (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (D:\Prog Test\protractor-cucumber-
master\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
[18:34:25] E/launcher - BUG: launcher exited with 1 tasks remaining
logger.js:158

下面是运行“npm install”后安装的package.json的依赖

{
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"cucumber": "^3.2.1",
"cucumber-html-report": "^0.6.2",
"cucumber-html-reporter": "^3.0.4",
"cucumberjs-allure-reporter": "^1.0.3",
"mkdirp": "^0.5.1",
"protractor": "^5.2.0",
"protractor-cucumber-framework": "^4.1.1"
},

}

下面是我对VSCOde的调试配置

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": [
"${workspaceRoot}/config/config.js"
],
}
]
}

最佳答案

在您的调试配置中的 "name": "Launch Program", 后面添加 "cwd": "${workspaceFolder}",,然后重试。

关于visual-studio-code - 在 visual studio 代码中调试 Protractor 测试时出现 cucumber 错误,但在运行模式下一切正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49734042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com