Skip to content

Breakpoint not hit on debugging unit tests using mocha #2590

@davidp-ctg

Description

@davidp-ctg

Version

3.0.3

Reproduction link

https://github.com/davidp-ctg/unit-test-example

Node and OS info

Node 10.10.0 / npm 6.4.1 / Windows 10

Steps to reproduce

  1. Create an example project with vue create unit-test-example using the following options:

Vue CLI v3.0.3
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, Router, Vuex, Linter, Unit
? Use history mode for router? (Requires proper server setup for index fallback in production) No
? Pick a linter / formatter config: Airbnb
? Pick additional lint features: Lint on save
? Pick a unit testing solution: Mocha
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files

  1. Set a breakpoint in the provided example unit test "example.spec.js" - either by debugger command or setting a breakpoint using your IDE (in my case VS Code)

  2. Run the tests with command: node --inspect-brk ./node_modules/@vue/cli-service/bin/vue-cli-service.js test:unit

  3. Attach debugger

What is expected?

Breakpoint is hit and attached debugger is waiting on the line of code with the breakpoint

What is actually happening?

Breakpoint is ignored and tests complete without stopping.


I used the documentation on how to debug the tests under jest plugin:
https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest#debugging-tests

since there is no documentation on how to do it using mocha plugin:
https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-mocha

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions