Я работаю над проблемами 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);
тест-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