具有异步mocha测试的详细错误日志

时间:2015-01-18 19:23:09

标签: javascript mocha

我有这个异步mocha测试,我返回一个错误对象来指示错误:

describe "error object", →
  it "should fail", (done) →
    done(new Error({link: "mock" }))

这是输出:

1) error object should fail:
Error: [object Object]

我希望看到细节:

1) error object should fail:
Error: { link: "mock" }

如何在mocha测试中看到详细的错误输出?

1 个答案:

答案 0 :(得分:0)

describe "error object",
  it "should fail", (done)
    done(new Error(JSON.stringify({link: "mock" })));