Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js with Ember.testing = true

I am trying to get testing working in Ember.js with the Ember.testing = true flag set to disable the automatic run loop etc

I have this code

Ember.testing = true;

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

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


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

And i get thuis error already

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 

I know you need to run async code within a Ember.run which i have as per any examples i can find!!

Can anyone show me what i am doing wrong or even get the jsin example to not show this error ?

See jsbin here http://jsbin.com/uxalap/14/edit

UPDATED:

I am using Konacha to run my tests and when i use the latest RC1 i get an error when wrapping the Ember.Application.create() and App.initialize() in Em.run. When i remove these i get no errors. Is this correct now in latest master ?

Thanks Rick

like image 874
Rick Moss Avatar asked Mar 10 '26 12:03

Rick Moss


1 Answers

Ember.testing was changed since RC1, if you want to use it you should use master

Here's an updated working JSBin

like image 54
Jakub Arnold Avatar answered Mar 12 '26 01:03

Jakub Arnold



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!