How to Debug Grunt Mocha Task?

后端 未结 4 1515
名媛妹妹
名媛妹妹 2021-02-08 20:07

I am using WebStorm to run a grunt task. The debugger successfully stops at the breakpoint in the Gruntfile.js file, but not in my task file.

In the Gruntfile.js I regis

4条回答
  •  灰色年华
    2021-02-08 20:29

    Finally I am able to debug my mocha tasks! Thanks for all your answers and comments, but unfortunately I have to select my own answer, because that is the only one that worked for me.

    Thanks to this video I found out what I was missing: http://vimeo.com/97561531

    Basically it was two things:

    1. Add a "debug-brk" option to grunt's mocha configuration:

      grunt.initConfig({
          ...
              "options": {
                  "mocha": {
                      ...
                      "debug-brk": (grunt.option('debug-brk')) ? "" : 0
                  }
              }
      }
      
    2. Configure WebStorm's Debug Configuration like this:

      WebStorm's Debug Config to Halt on debug-brk

提交回复
热议问题