2013-07-26 41 views
3

我一直有問題後得到Behat與Zombie.js合作的問題。我現在得到的問題實際上是在Zombie.js模塊中(之前,錯誤在兩者之間的鏈接中)。Zombie.js Behat和水貂

錯誤看起來像這樣。

[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。這應該是不可能的,對吧?

+0

您使用的是什麼版本的nodejs? –

回答

0

同樣的問題,試圖模擬一個$ nodeElement->鼠標懸停()與貂/貝哈特/ Symfony2.1

TypeError: Parameter 'url' must be a string, not object 
    at Url.parse (url.js:107:11) 
    at urlParse (url.js:101:5) 
    at Object.urlResolve [as resolve] (url.js:405:10) 
    at Object.iframe.setAttribute (/usr/lib/node_modules/zombie/lib/zombie/jsdom_patches.js:164:43) 
    at attrCopy (/usr/lib/node_modules/zombie/node_modules/jsdom/lib/jsdom/level1/core.js:331:14) 
    at Object.core.Node.cloneNode (/usr/lib/node_modules/zombie/node_modules/jsdom/lib/jsdom/level1/core.js:636:18) 
    at Object.core.Node.cloneNode (/usr/lib/node_modules/zombie/node_modules/jsdom/lib/jsdom/level1/core.js:706:37) 
    at Function.jQuery.extend.clone (/js/2225e47_jquery-1.8.2_2.js:6222:17) 
    at Function.jQuery.extend.parseHTML (/js/2225e47_jquery-1.8.2_2.js:501:31) 
    at jQuery.fn.jQuery.init (/js/2225e47_jquery-1.8.2_2.js:131:24) 
    at jQuery (/js/2225e47_jquery-1.8.2_2.js:44:10) 
    in /js/45a7194_jquery.jqModal_9.js 

節點版本時是v0.10.15。仍在挖掘答案。

1

殭屍驅動程序破壞節點版本0.8.24(0.8.23工作正常)。我相信這是由於變化:

2013.06.04, Version 0.8.24 (maintenance), c1a1ab067721ea17ef7b05ec5c68b17f05 

* url: Properly parse certain oddly formed urls (isaacs) 

了類似的變化(在同一天進行)似乎在0.10.10進行了(雖然我沒有直接研究了提交)。

2013.06.04, Version 0.10.10 (Stable), 25e51c396aa23018603baae2b1d9390f5d9db496 

* url: Properly parse certain oddly formed urls (isaacs) 

我建議恢復到0.8.23或0.10.9爲了得到這個工作。如果您尚未使用它,我建議您使用nvm來管理您的節點安裝。