lundi 31 octobre 2016

Using async/await in test mode without Ember.run

I'm trying to use async/await functions in an Ember 2.9 project.I have this simple code :

import Route from 'ember-route';

export default Route.extend({
  async model(params) {
    const activity = await this.store.findRecord('activity', params.activity_id);

    this.set('activity', activity);

    return activity.get('courses');
  }
});

I works on dev mode but when I run a test, I have this message :

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 a run

I understood than I can use Ember.run but using async/await become completly useless.

Is there a solution ?




Aucun commentaire:

Enregistrer un commentaire