matandked
matandked

Reputation: 1565

How can I create a configuration entry to start server and debug Protractor tests in Visual Studio Code?

Thanks to the ng e2e, I can run the server and then execute end to end Protractor tests against it. npm run ng e2e command accomplish this task for me.

Now, I would like to create a Visual Studio configuration to debug those tests. According to the description on MSDN blog in .vscode/launch.json, I created a configuration for debugging Protractor tests:

{
    "type": "node",
    "request": "launch",
    "name": "Launch e2e tests",
    "program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
    "stopOnEntry": false,
    "args": ["${workspaceRoot}/protractor.conf.js"],
},

However it is not running the server, it runs the tests only. As a results, they're marked as failed.

How can I amend the configuration to not only run the tests, but to start the server first? Obviously I need to have debugging possibilities such as inserting the break points in VS Code.

Upvotes: 0

Views: 72

Answers (1)

yong
yong

Reputation: 13712

"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceFolder}/node_modules/@angular/cli/bin/ng",
        "cwd": "${workspaceFolder}",
        "args": [
            "e2e"
        ]
    }
]

Upvotes: 1

Related Questions