Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakpoints and variables/watch not matching up with code when running mocha with babel6 #3701

Closed
jpierson opened this issue Mar 4, 2016 · 3 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@jpierson
Copy link

jpierson commented Mar 4, 2016

I have a few mocha tests that need to exercise some ES6 code which is normally targeted for the browser. I'm using babel through webpack to manage packaging this up on the fly using webpack-dev-server. In order to support running the tests in node I've opted to use the --compilers js:babel-core/register option with mocha to allow dynamic compiling of the ES5 tests and their imports. I've followed advice given for other related issues by trying to precompile the source, ensuring I have source maps enabled, and setting outDir as needed in the launch.json file but I'm still not getting good results. I've also made sure that my path doesn't contain any spaces. I've also tried various forms source maps (inline, both, true, ...). Eventually when letting the test run through an error is hit but error shows is a line that appears to be the transpiled code as opposed to the original source.

My launch configuration:

{
    "name": "Test",
    "type": "node",
    "request": "launch",
    "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
    "stopOnEntry": false,
    "args": ["./test/**/*.js", "--compilers", "js:babel-core/register", "--require", "babel-polyfill"],
    "cwd": "${workspaceRoot}",
    "runtimeExecutable": null,
    "runtimeArgs": [
        "--nolazy"
    ],
    "env": {
        "NODE_ENV": "development"
    },
    "externalConsole": false,
    "sourceMaps": true,
    "outDir": "${workspaceRoot}/lib"
}

Possibly related issues:

@isidorn isidorn added the debug Debug viewlet, configurations, breakpoints, adapter issues label Mar 4, 2016
@jpierson
Copy link
Author

jpierson commented Mar 5, 2016

After various changes and a reboot things are looking much better all of the sudden. I'm also working on a separate group of tests so I'm unsure what may have jolted it into place. If I can narrow it down more I'll provide more details.

@weinand
Copy link
Contributor

weinand commented Mar 7, 2016

@jpierson please let me know if you have more info and I will reopen this issue.

@weinand weinand closed this as completed Mar 7, 2016
@zjaml
Copy link

zjaml commented Jul 2, 2016

@weinand
First, I switched to VSCode recently and just love it, great work guys!

I'm having pretty similar problems with the latest vscode, the breakpoint just won't match for me.
I built a sample repo here to help you reproduce the issue.
Would be much appreciated if you can point me where I did wrong. It would be awesome to be able to setup the workflow this way.

https://github.com/zjaml/vscode-mocha-issue/tree/master

Thanks

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

4 participants