Rick Moss
Rick Moss

Reputation: 926

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

Upvotes: 3

Views: 1401

Answers (1)

Jakub Arnold
Jakub Arnold

Reputation: 87210

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

Here's an updated working JSBin

Upvotes: 1

Related Questions