如何在vows nodejs中调试测试?

时间:2012-06-03 00:06:40

标签: debugging testing vows

如何调试誓言测试?

我正在考虑为测试做一个html报告,并在浏览器中运行测试,但我真的不知道如何以及从哪里开始。

如果有更好的解决方法,我很高兴听到,谢谢;) 我记者的代码

this.print = function (str) {
    util.print(str);
};


function removeCircularSuite(obj, suite) {
    var result = {};

    if (typeof obj !== 'object' || obj === null) return obj;

    Object.keys(obj).forEach(function(key) {
        if (obj[key] === suite) {
            result[key] = {};
        } else {
            result[key] = removeCircularSuite(obj[key], suite || obj.suite);
        }
    });

    return result;
};

this.report = function (obj) {
    this.i++;
    console2.log(this.i);
    puts(JSON.stringify(removeCircularSuite(obj)));
};

但是它运行了两次所以它的输出是:

1
1
{"0":"subject","1":"insert worker"}
2
{"0":"subject","1":"insert worker"}
{"0":"context","1":"insertWorker"}
2
{"0":"context","1":"insertWorker"}
3
{"0":"vow","1":{"title":"find worker in the database","context":"insertWorker","status":"broken","exception":"\u001b[33mfound multiple records with the same _id\u001b[39m\u001b[90m // services.insertWorker.test.js:25\u001b[39m"}}
3
{"0":"vow","1":{"title":"find worker in the database","context":"insertWorker","status":"broken","exception":"\u001b[33mfound multiple records with the same _id\u001b[39m\u001b[90m // services.insertWorker.test.js:25\u001b[39m"}}
4
{"0":"end"}
5
4
{"0":"finish","1":{"honored":0,"broken":1,"errored":0,"pending":0,"total":1,"time":0.005}}
{"0":"end"}
5
{"0":"finish","1":{"honored":0,"broken":1,"errored":0,"pending":0,"total":1,"time":0.005}}

0 个答案:

没有答案