我正在尝试开始使用Vows和Vows-BDD。不幸的是,这些回调使我感到震惊。
在以下非常简单的示例中,如何解决此错误?
** Inside the first context
** Creating Person with name Nick
✗ Errored » callback not fired
in Create a Person via JavaScript: When a person has a name,
in Creating a Person
in undefined✗ Errored » 1 errored 1 dropped
vows_bdd = require "vows-bdd"
assert = require "assert"
class Person
constructor: (@name) ->
console.log "** Creating Person with name #{@name}"
greeting: ->
"Hello, #{@name}"
vows_bdd
.Feature("Creating a Person")
.scenario("Create a Person via JavaScript")
.when "a person has a name", ->
console.log "** Inside the first context"
new Person "Nick"
.then "the person can be greeted", (person) ->
console.log "person is a #{typeof person} = [#{person}]"
assert.equal person.greeting(), "Hello, Nick"
.complete()
.finish(module)
最佳答案
我知道这篇文章很旧,但是因为这是有人搜索此错误时的第一个结果,所以我发布了我的答案。
处理错误时,我发现这篇文章很有帮助。
http://birkett.no/blog/2013/05/01/vows-errored-callback-not-fired/。
在我的代码中,错误是由于其中一个主题发生异常而引起的。 Vows不会打印实际错误,因为它很难理解确切的问题。