4
我想用Vows和Vows-BDD開始。不幸的是,回調讓我沮喪。如何用Vows和Node.js解決「回調未被觸發」
在下面的非常簡單的例子中,如何解決這個錯誤?
** 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)
不幸的是,該鏈接似乎已經死了,但仍然+1回答舊帖子:) –
@RohanJ,由於鏈接不再起作用,你可以發佈它解釋的解決方案嗎? – nickh
@nickh對不起,這是很久以前,因爲我沒有做過誓言,所以我不記得確切的解決方案。但我認爲其中一個主題正在拋出異常,因爲發生這種錯誤。我應該更清楚地記錄它,對此抱歉。 – RohanJ