How to debug Cucumber in Visual Studio Code (VSCode)?

前端 未结 4 1890
既然无缘
既然无缘 2021-01-02 09:57

I was trying to debug Cucumber scenarios in Visual Studio code and made below changes in the launch.json.

{
            \"name\": \"e2e\",
              


        
4条回答
  •  轮回少年
    2021-01-02 10:54

    Tweaking the answer from Mukesh Rawat plus ensuring additional file paths were correct, got it working for me, :

    Launch.json

    {
        "name": "DebugMode",
        "type": "node",
        "request": "launch",
        "program": "${workspaceRoot}/node_modules/cucumber/bin/cucumber-js",
        "args": [
            "${workspaceRoot}/features/*.feature",
            "--tags", "@debug"
        ]
    }
    

    Workspace.json

    {
        "cucumberautocomplete.steps": [
            "features/steps/*.js"
        ],
        "cucumberautocomplete.syncfeatures": "features/*.feature",
        "cucumberautocomplete.strictGherkinCompletion": true,
        "settings": {},
        "folders": [
            {
                "path": "/Users/{me}/Documents/{project folder}/{project name}"
            }
        ]
    }
    

    Package.json

    "scripts": {
        "debug": "node --inspect=1337 --debug-brk --nolazy node_modules/cucumber/bin/cucumber-js --tags @debug --format json:./reports/report.json",
    

    CucumberTest.feature

    @debug
    Scenario: Validate I can get debug working
    

提交回复
热议问题