user7614197
user7614197

Reputation:

How do you debug the cucumber step definitions w/ Visual Studio Code?

I'm using the protractor-cucumber-framework to create a testbed environment for our QA team. I've searched around and been able to find zero help in implementing VS Code's debugging capability for use in this code. Has anyone does this? I'd really like to step away from console.log() statements.

Upvotes: 4

Views: 2723

Answers (1)

yong
yong

Reputation: 13722

1) Upgrade your Nodejs to 8 and later
2) Create a folder .vscode under your project base directory
3) Create a file launch.json under .vscode
4) Copy below content into launch.json

{
    // Use IntelliSense to learn about possible Node.js debug 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": "gie",
        "program": "${workspaceFolder}/node_modules/protractor/built/cli.js",
        "cwd": "${workspaceFolder}",
        "args": [
            "config/gie.config.js",
            "--browser=chrome"
        ]
    }]
}

The ${workspaceFolder} represent your project base directory
The first value in args is your protractor config file, you can use relative path to ${workspaceFolder}
The second and next value in args is command options as you type in command line to run test.

My Environment: VSCode 1.8.1, Nodejs v8.9.0, Protractor 5.2.0,

Upvotes: 2

Related Questions