How to debug ES6 mocha tests in Visual Studio Code
Previously, when I tried to debug the failed test in mocha, I start mocha in bash with --debug-brk
, and attached the Visual Studio Code to that mocha process. My code is written in ES6, and I run mocha via babel-register
. When I tried to enjoy the built-in debug function in VSC. Somehow, the stack seems completely irrelative to the actual code. Take me a while to figure it out. I searched a lot online, assembled all the information to solve the problem, I think it worths a blog to save someone else time.