vdrulerz
vdrulerz

Reputation: 264

Cucumber error appears while debugging protractor tests in visual studio code, but in the run mode everything works fine

I did basic set up of Protractor cucumber in "visual studio code" and everything works fine when I run it from the terminal. However when I debug it through visual studio code it gives me version error. I have not installed Cucumber globally. I installed it through npm install in the local directory but still the error message says that I am keeping two different versions. How come it be possible?

This error message should also come in the run mode why is it coming only in the debug mode. Please see below error.

[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

Below are the dependencies of package.json which got installed after running "npm install"

{
"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"
},

}

Below is my debug configuration of 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"
        ],
    }
]
}

Upvotes: 3

Views: 921

Answers (1)

yong
yong

Reputation: 13722

Add "cwd": "${workspaceFolder}", behind "name": "Launch Program", in your debug configuration, then try again.

Upvotes: 5

Related Questions