console.trace返回的值不正确

时间:2019-01-08 00:55:02

标签: javascript node.js console.log

我正在研究Nodeschool的挑战。我目前正在研究Bug Clinic的第二个挑战,即“ TRIAGE(console.log和好友)”:

npm install -g bug-clinic

这是我的解决方法:

scenario.js:

 var fs = require("fs");

 var peach = function (obj) {
   console.trace("traced");
   console.log(obj);
 };

 var bowser = function (callback) {
   fs.readFile(process.argv[2], {encoding : "utf8"}, callback);
 };

 var koopa = function (error, file) {
    console.error(error);
   peach(JSON.parse(file));
 };

 bowser(koopa);

test-output.json:

{
    "mushroomKingdom": [
        "Super Mario Bros",
        "Super Mario Bros 2",
        "Super Mario Bros 3",
        "Super Mario World",
        "Super Mario 64",
        "Super Mario Sunshine",
        "Super Mario Galaxy"
    ]
}

我看到这些错误消息,但我不知道需要更改什么

TAP version 13
# (anonymous)
ok 1 (unnamed assert)
ok 2 no standard output
ok 3 program executed successfully
not ok 4 found trace 1 (will you always have an error?)
  ---
    operator: equal
    expected: 0
    actual:   5
    at: maybeClose (internal/child_process.js:962:16)
  ...
ok 5 found more evidence that trace worked
ok 6 found yet even more evidence
ok 7 got the expected JSON
ok 8 JSON parsed OK

1..8
# tests 8
# pass  7
# fail  1

0 个答案:

没有答案