【发布时间】:2013-07-26 14:49:09
【问题描述】:
在让 Behat 与 Zombie.js 一起工作时,我遇到了一个又一个的问题。我现在遇到的问题实际上是在 Zombie.js 模块中(之前,错误在两者之间的链接中)。
错误看起来是这样的。
[RuntimeException]
Server process has been terminated: (8) [
url.js:107
throw new TypeError("Parameter 'url' must be a string, not " + typeof url)
^
TypeError: Parameter 'url' must be a string, not undefined
at Url.parse (url.js:107:11)
at urlParse (url.js:101:5)
at Object.urlResolve [as resolve] (url.js:405:10)
at History._resolve (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/history.coffee:201:20)
at History._assign (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/history.coffee:209:18)
at /Users/nathanielh/www/website/node_modules/zombie/lib/zombie/browser.coffee:326:30
at Browser.withOptions (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/browser.coffee:105:14)
at Browser.visit (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/browser.coffee:320:12)
at Socket.eval (eval at <anonymous> (/private/var/folders/fv/fp4xrfnx7kzfq2bqzywq5p9w00010f/T/mink_nodejs_serverSZBH0W:43:10), <anonymous>:2:9)
at Socket.<anonymous> (/private/var/folders/fv/fp4xrfnx7kzfq2bqzywq5p9w00010f/T/mink_nodejs_serverSZBH0W:43:5)
]
我发现在history.coffee 中,resolve 函数试图使用一个不存在的数组元素。
// history.coffee
_resolve: (url)->
if url
return URL.resolve(@_stack[@_index]?.url, url)
else # Yes, this could happen
return @_stack[@_index]?.url
对@_stack[@_index] 的引用解析为未定义,然后将其传递给URL.resolve,从而导致错误。
知道为什么会这样吗?
更新
我注意到@_stack 是空的,而@_index 是-1。这应该是不可能的吧?
【问题讨论】:
-
你用的是什么版本的nodejs?
标签: javascript php behat mink zombie.js