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

Debug code / test using breakpoints #901

Closed
ConnorStroomberg opened this issue Feb 28, 2018 · 3 comments
Closed

Debug code / test using breakpoints #901

ConnorStroomberg opened this issue Feb 28, 2018 · 3 comments

Comments

@ConnorStroomberg
Copy link

What problem does this feature solve?

Fix errors in your test or code under test by setting a break point and inspecting the system state.

Using the 2.x CLI combined with Karma Chrome/Firefox/... i could run a test and use the browsers build in debugger to debug de code. In the new CLI ( 3.x with jsdom) i do not see how this is done in a clean and easy to use way.

What does the proposed API look like?

yarn test --debug

@yyx990803
Copy link
Member

This may help:

I doubt we can make this part of the command itself.

@wangxuepeng
Copy link

wangxuepeng commented Aug 28, 2018

Debug Jest unit test following the links works perfect:

`

{

        "type": "node",

        "request": "launch",

        "name": "Jest",

        "protocol": "inspector",

        "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",

        "args": ["--runInBand"],

        "console": "integratedTerminal",

        "sourceMaps": true,

        "stopOnEntry": false

      },

`

but the same approach for mocha does not work:
`

{

        "type": "node",

        "request": "launch",

        "name": "Mocha",

        "protocol": "inspector",

        "program": "${workspaceRoot}/node_modules/mocha-webpack/bin/mocha-webpack",

        "args": [

            "--timeout",

            "999999",

            "--colors",

            "${workspaceFolder}/tests/**/*.spec.*"

        ],

        "console": "integratedTerminal",

        "sourceMaps": true,

        "stopOnEntry": false

      },

`,

it prompts error below:

_WEBPACK Failed to compile with 1 error(s)

Error in ./tests/unit/HelloWorld.spec.js

Module not found: "@/components/HelloWorld.vue" in "/Users/mkw/Dev/vue_mocha/tests/unit"

Waiting for the debugger to disconnect...
Killed: 9_

Looks like it need some webpack configuration?

BTW, I also check link feat(service): Enable inspector debugging for unit test by mocha, it seems the solution, but how to config it in VSCode?

Thanks.

@LinusBorg
Copy link
Member

Please use forum.vuejs.org for support questions. this issue is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants