I have experienced issues with this addon in acceptance tests ever since I updated from Ember 2.14 to 2.15. My acceptance tests get stuck in an infinite loop when calling platform.nowon this line of backburner.js
I believe its because backburner.js v1.1.2 made some changes to the way that v0.4.0 (which was in 2.14) used to handle getting now.
A PR that is now in v1.1.2 exposed a way to configure now seperate to the global Date object - https://github.com/BackburnerJS/backburner.js/pull/264. Unfortunately by calling freezeDateAt in an acceptance test, it now also freezes backburners concept of now, which means all of its internal timers never progress and the tests lock up.
I have managed to get around this problem by implementing my own helpers methods.
import { freezeDateAt as fda, unfreezeDate as ufd } from 'ember-mockdate-shim';
const ogDate = Date;
const ogPlatformNow = Ember.run.backburner._platform.now;
// Create our own version of freezeDateAt that first calls the freeze date mock date
// function, AND then monkeypatches the backburner now function back to the og date
// reference so that ember run loop doesn't get stuck in a loop.
export const freezeDateAt = function(date) {
fda(date);
Ember.run.backburner._platform.now = () => ogDate();
};
// Restore the original platform now function before calling the mockdate unfreeze
// function.
export const unfreezeDate = function() {
Ember.run.backburner._platform.now = ogPlatformNow;
ufd();
};
Perhaps these functions could be worked back into this shim properly?
I have experienced issues with this addon in acceptance tests ever since I updated from Ember 2.14 to 2.15. My acceptance tests get stuck in an infinite loop when calling
platform.now
on this line ofbackburner.js
I believe its because
backburner.js v1.1.2
made some changes to the way thatv0.4.0
(which was in 2.14) used to handle gettingnow
. A PR that is now inv1.1.2
exposed a way to configure now seperate to the global Date object - https://github.com/BackburnerJS/backburner.js/pull/264. Unfortunately by callingfreezeDateAt
in an acceptance test, it now also freezes backburners concept of now, which means all of its internal timers never progress and the tests lock up.I have managed to get around this problem by implementing my own helpers methods.
Perhaps these functions could be worked back into this shim properly?