繁体   English   中英

如何与mocha和node-inspector并行运行grunt任务

[英]How to run with mocha and node-inspector parallel with grunt tasks

目前,我正在使用简单上手的grunt任务进行测试。 我想在运行测试时调试代码。 我该怎么做呢?

    simplemocha: {
        options: {
            globals: ['expect'],
            timeout: 3000,
            ignoreLeaks: false,
            ui: 'bdd',
            reporter: 'tap'
        },
        all: {
            src: ['test/*.js']
        }
    },

我可以想到两种方法来实现这一目标。 一个正在使用此grunt任务作为您自己的test-debug任务的步骤(与您的simplemocha任务完全相同,但首先运行grunt-debug): https : //github.com/burnnat/grunt-debug

您必须通过将插件添加到您的Gruntfile中来启用该插件:

grunt.loadNpmTasks('grunt-debug');

然后在控制台中运行现有任务之前先进行debug

grunt debug simplemocha

或者,您可以通过传递主要grunt脚本和参数来调用nodejs --debug 在Linux bash中执行此操作的便捷方法是nodejs --debug $(which grunt) simplemocha

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM