I've been having problem after problem with getting Behat to work with Zombie.js. The problem I've got now is actually within the Zombie.js module (before, the errors were in the link between the two).
The error looks like so.
[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)
]
I've found that in history.coffee
, the resolve
function is trying to use an array element that doesn't exist.
// history.coffee
_resolve: (url)->
if url
return URL.resolve(@_stack[@_index]?.url, url)
else # Yes, this could happen
return @_stack[@_index]?.url
That reference to @_stack[@_index]
resolves to undefined, which is then being passed into URL.resolve
, which is then causing the error.
Any idea why this would happen?
Update
I've noticed that @_stack
is empty, and @_index
is -1
. This shouldn't be possible, right?