目前,我正在使用simple-mocha grunt任务运行测试。我想在运行测试时调试代码。我怎么用grunt做到这一点呢?
simplemocha: {
options: {
globals: ['expect'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'tap'
},
all: {
src: ['test/*.js']
}
},发布于 2014-08-11 00:30:11
我可以想到两种方法来实现这一点。一种是使用这个grunt任务作为您自己的测试-调试任务的一个步骤(执行与您的simplemocha任务完全相同的操作,但首先运行grunt-debug ):https://github.com/burnnat/grunt-debug
您必须通过将以下内容添加到Gruntfile文件中来启用该插件:
grunt.loadNpmTasks('grunt-debug');然后在控制台中,在运行现有任务之前预先添加debug:
grunt debug simplemocha或者,您可以调用nodejs --debug来传递主grunt脚本和参数。在Linux bash中实现这一点的一种便捷方法是nodejs --debug $(which grunt) simplemocha。
https://stackoverflow.com/questions/25229294
复制相似问题