2013-03-11 43 views
3

我試圖讓測試在Ember.js工作設置爲禁用自動運行循環等Ember.js與Ember.testing =真

我有這樣的代碼

的Ember.testing = true標誌
Ember.testing = true; 

Ember.run(function() { 
    App = Ember.Application.create(); 
}); 

App.Router.map(function() { 
    this.route("home", { path: "/" }); 
}); 


Ember.run(function() { 
    App.initialize(); 
}); 

,我得到的Thuis錯誤已經

Uncaught Error: assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run 

我知道你需要一個Ember.run我已經按照任何的例子我能找到內運行的異步代碼!

任何人都可以告訴我我做錯了什麼,甚至得到jsin示例不顯示此錯誤?

jsbin這裏http://jsbin.com/uxalap/14/edit

更新參閱:

我使用Konacha運行我的測試中,當我使用最新的RC1我包裹Ember.Application.create()和應用程序時出現錯誤。在Em.run中初始化()。當我刪除這些我沒有得到任何錯誤。現在最新的主人是否正確?因爲RC1

感謝 裏克

+0

把你的'App.Router.map'呼叫並在運行塊。 – 2013-03-11 12:03:38

+0

@Waleed Khan謝謝,但是當我在jsbin中這樣做時,我仍然得到相同的錯誤。你不是嗎? – 2013-03-11 12:19:05

回答