visual studio代码debuggin mocha忽略断点 [英] visual studio code debuggin mocha is ignoring breakpoints

查看:398
本文介绍了visual studio代码debuggin mocha忽略断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在视觉工作室代码中调试摩卡单元测试。我遵循了这个问题,并得到此运行配置:

  {
name:运行摩卡,
type:node,
程序:/ usr / bin / mocha,
stopOnEntry:false,
args:[testUtils.js],
cwd:$ {workspaceRoot} ,
runtimeExecutable:null,
env:{NODE_ENV:development}
},

它可以工作。但是它不会在断点停止!如果我使用正常的启动配置运行文件,则不会忽略断点。



任何想法可能是什么原因?

解决方案

这适用于我,你需要指向 _mocha 。使用 mocha 不允许附加断点。

  {
name:Debug mocha,
type:node,
request:launch,
runtimeArgs:[C:\\ Users \\\\\\AppData\\\\\\\\\\\\\\\\\\\\\\\\\\\\_mocha],
程序:$ {workspaceRoot} \\test.js,
stopOnEntry:false,
args:[
],
cwd $ {workspaceRoot},
runtimeExecutable:null,
env:{
NODE_ENV:development
}
}


I am trying to debug mocha unit test in visual studio code. I followed this question and got this run configuration:

    {
        "name": "Run mocha",
        "type": "node",
        "program": "/usr/bin/mocha",
        "stopOnEntry": false,
        "args": ["testUtils.js"],
        "cwd": "${workspaceRoot}",
        "runtimeExecutable": null,
        "env": { "NODE_ENV": "development"}
    },

It works. But it does not stop at breakpoints! If I run the file with a normal launch configuration, breakpoints are not ignored.

Any Idea what could be the reason for this?

解决方案

This works for me, you need to point to _mocha. Using just mocha does not allow attaching breakpoints.

    {
        "name": "Debug mocha",
        "type": "node",
        "request": "launch",
        "runtimeArgs": ["C:\\Users\\CS\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\_mocha"],
        "program": "${workspaceRoot}\\test.js",
        "stopOnEntry": false,
        "args": [
        ],
        "cwd": "${workspaceRoot}",
        "runtimeExecutable": null,
        "env": {
            "NODE_ENV": "development"
        }
    }

这篇关于visual studio代码debuggin mocha忽略断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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