Error: Can't set timers inside simulations

Why cant you set timers in simulations? Is there any way of breaking out of the simulation?

Meteor.methods
  action: ->
    if Meteor.isClient
      Meteor.setTimeout(something, 1000)

I can’t try right now, but I think I successfully used setTimeout in simulations. Are you sure your stub is actually called?

verbatim – added this to the leaderboard app

Meteor.methods({
  action: function () {
    if (Meteor.isClient) {
      Meteor.setTimeout(function() {
        alert('yay!')
      }, 1000)
    }
  }
});

then in the console:

Meteor.call('action')
debug.js:43 Exception while simulating the effect of invoking 'action' Error: Can't set timers inside simulations
    at withoutInvocation (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:434:13)
    at bindAndCatch (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:442:33)
    at Object._.extend.setTimeout (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:458:23)
    at Meteor.methods.action (http://localhost:3000/leaderboard.js?750ee55659313db62f34866175ef2dded25696cd:46:14)
    at http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4269:25
    at _.extend.withValue (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:955:17)
    at _.extend.apply (http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4260:54)
    at _.extend.call (http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4138:17)
    at <anonymous>:2:8
    at Object.InjectedScript._evaluateOn (<anonymous>:905:140) Error: Can't set timers inside simulations
    at withoutInvocation (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:434:13)
    at bindAndCatch (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:442:33)
    at Object._.extend.setTimeout (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:458:23)
    at Meteor.methods.action (http://localhost:3000/leaderboard.js?750ee55659313db62f34866175ef2dded25696cd:46:14)
    at http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4269:25
    at _.extend.withValue (http://localhost:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:955:17)
    at _.extend.apply (http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4260:54)
    at _.extend.call (http://localhost:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:4138:17)
    at <anonymous>:2:8
    at Object.InjectedScript._evaluateOn (<anonymous>:905:140)
undefined

Doing a Google search on Error: Can’t set timers inside simulations, it seems it is a Meteor feature that you can circumvent by using setTimeout instead of Meteor.setTimeout.