如何在Visual Studio Code(VSCode)中调试Cucumber? [英] How to debug Cucumber in Visual Studio Code (VSCode)?

查看:639
本文介绍了如何在Visual Studio Code(VSCode)中调试Cucumber?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Visual Studio代码中调试Cucumber方案,并在launch.json中进行了以下更改.

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

{
            "name": "e2e",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}\\node_modules\\.bin\\cucumber-js",
            "stopOnEntry": false,
            "args": ["--no-timeouts", "--colors"],
            "cwd": "${workspaceRoot}",
            "runtimeExecutable": null,
            "outFiles": [
                "${workspaceRoot}\\features\\step_definitions\\*.js"
            ]
},

但是,我无法使用上述配置运行调试会话.步骤def.我在JavaScript中创建的文件. 因此,如果看起来不错,只需要上面脚本的帮助?

However, I am not able run a debug session using the above configuration. The step def. files I created in JavaScript. So, just need a help on the script above if that looks fine?

推荐答案

您可以尝试以下配置,以使调试工作在VS Code中进行.在outFiles中,输入要素文件路径.

You could try below configuration to make your debug working in VS Code. In the outFiles give your feature file path.

{
    "name": "e2e",
    "type": "node",
    "request": "launch",
    "program": "${workspaceRoot}/node_modules/cucumber/bin/cucumber.js",
    "outFiles": [
        "${workspaceRoot}/features/*.feature"
    ]
}

=============================================
更新自黄瓜^ 5.0.2:

{
    "name": "NPM Cukes",
    "type": "node",
    "request": "launch",
    "console": "integratedTerminal",
    "program": "${workspaceRoot}/node_modules/cucumber/bin/cucumber-js",
    "args": [
        "path/to/features/**/*.feature",
        "-r",
        "path/to/steps/**/*",
        "--tags",
        "@your-tags"
    ]
}

如果您只想调试CURRENT功能,请将其添加到launch.json

If you want to debug only CURRENT feature, add this to launch.json

{
    "type": "node",
    "request": "launch",
    "program": "${workspaceFolder}/node_modules/.bin/cucumber-js",
    "args": ["${relativeFile}"],
    "name": "Cukes current",
    "console": "integratedTerminal",
    "internalConsoleOptions": "neverOpen",
    "windows": {
        "program": "${workspaceFolder}/node_modules/cucumber/bin/cucumber"
    }
}   

这篇关于如何在Visual Studio Code(VSCode)中调试Cucumber?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆