Skip to content

Commit

Permalink
Drop autorun assertion
Browse files Browse the repository at this point in the history
This removes the autorun assertion in test mode. The original conditions that caused it to be added are no longer true, as we are on a version of backburner that uses microtask scheduling.
  • Loading branch information
ef4 committed Jul 6, 2018
1 parent 64fe277 commit cff0b10
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
17 changes: 1 addition & 16 deletions packages/@ember/runloop/index.js
@@ -1,4 +1,4 @@
import { assert, deprecate, isTesting } from '@ember/debug';
import { assert, deprecate } from '@ember/debug';
import { onErrorTarget } from 'ember-error-handling';
import { beginPropertyChanges, endPropertyChanges } from 'ember-metal';
import Backburner from 'backburner';
Expand Down Expand Up @@ -325,11 +325,6 @@ export function end() {
@public
*/
export function schedule(queue /*, target, method */) {
assert(
`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`,
currentRunLoop || !isTesting()
);
deprecate(`Scheduling into the '${queue}' run loop queue is deprecated.`, queue !== 'sync', {
id: 'ember-metal.run.sync',
until: '3.5.0',
Expand Down Expand Up @@ -398,11 +393,6 @@ export function later(/*target, method*/) {
@public
*/
export function once(...args) {
assert(
`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`,
currentRunLoop || !isTesting()
);
args.unshift('actions');
return backburner.scheduleOnce(...args);
}
Expand Down Expand Up @@ -480,11 +470,6 @@ export function once(...args) {
@public
*/
export function scheduleOnce(queue /*, target, method*/) {
assert(
`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`,
currentRunLoop || !isTesting()
);
deprecate(`Scheduling into the '${queue}' run loop queue is deprecated.`, queue !== 'sync', {
id: 'ember-metal.run.sync',
until: '3.5.0',
Expand Down
13 changes: 0 additions & 13 deletions packages/@ember/runloop/tests/schedule_test.js
Expand Up @@ -82,18 +82,5 @@ moduleFor(

assert.deepEqual(order, ['sync', 'actions', 'sync', 'actions', 'destroy']);
}

['@test makes sure it does not trigger an autorun during testing']() {
expectAssertion(
() => schedule('actions', () => {}),
/wrap any code with asynchronous side-effects in a run/
);

// make sure not just the first violation is asserted.
expectAssertion(
() => schedule('actions', () => {}),
/wrap any code with asynchronous side-effects in a run/
);
}
}
);

0 comments on commit cff0b10

Please sign in to comment.