Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

This issue has been tracked since 2017-11-13.

I have a test with moxios and those results are an error, I read the docs and I wrote the same form that of these describe in how define an async test,the error is, I read also the docs of jasmine. Do you knows what happens?

Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at node_modules/jest-jasmine2/build/queue_runner.js:65:21
at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:523:19)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)

`import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import multi from 'redux-multi';
import promise from 'redux-promise';

import moxios from 'moxios';

import LocalStorageMock from '../../layouts/mock-localstorage'
import { password, leavePassword, restorePass, types } from '../../actions/password-actions';

//const middlewares = [multi];
const middlewares = [multi,thunk];
//const middlewares = [multi,promise];
const mockStore=configureStore(middlewares);

const baseUrl = 'localhost/project';
const REGISTER_ENDPOINT = 'account/password';
const RESTORE_ENDPOINT = 'account/reset_password/init';

let originalTimeout;
beforeEach(() =>{
//originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;//that not works
//jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;//that not works
afterEach(() => {
//jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;//that not works

global.localStorage= new LocalStorageMock('auth');

it('when user set password isnt valid', async(done)=>{ //it('when user set password isnt valid',()=>{
const store = mockStore({password:{}});
const path = baseUrl + REGISTER_ENDPOINT;
status: 404,

const values = { 
    newPassword: 'password',
    email: '[email protected]',
    key: 'eXyGsaerFAS213das&%ASDas'

const actions= store.getActions();

expect(actions[1].payload).not.toBe(null || undefined);

await actions[1].payload.then((response)=>{

});Action creator// tipos de acciones que se generaran
export const types = {
SETPASS_STARTED: '#password/setPass_started',
SETED_PASS: '#password/seted_pass',
LEAVE_COMPONENT: '#password/leave_pass',
RESTORE_STARTED: '#password/restore_started',
RESTORE_PASS: '#password/restore',

// creador de accion cuando se setea el password por primera vez
export const password = (values) => {
const data = {
newPassword: values.password,
email: values.email,
key: values.key,
let request = axios.post(${Config.baseUrl}${REGISTER_ENDPOINT}, data, {
auth: {
username: Config.oauth.appUser,
password: Config.oauth.appPassword,

return [{
type: types.SETPASS_STARTED,
}, {
type: types.SETED_PASS,
payload: request,

vjwilson wrote this answer on 2018-01-02

@canoqb10 ,

The default time moxios waits before it returns a mock response is 100ms, and you have to override it on each individual call. (There's an open issue about this being too long, #16 )

You can add a small number at the end of the parameter list for each moxios method call to reduce this delay.


moxios.stubRequest(path, {
  status: 404,
  response: {
}, 5);

where that last 5 changes the delay to 5ms.

Hope this helps.

anilanar wrote this answer on 2018-05-27

Kamino cloned this issue to anilanar/moxios

jwallet wrote this answer on 2018-07-06

I had the same issue, this is the first result when googling this issue. So I leave here my solution.
If you have multiple moxios like this

moxios.wait(() => {
  const requestInternet = moxios.requests.at(0);
    status: 200,
    response: true
  done(); //add the done() callback after the first request to know what's really happening
  moxios.wait(() => {
    const requestTransaction = moxios.requests.at(1);
      status: 200,
      response: transactionResult

It won't be able to show you the actual error because it fails on the first call and it's waiting for the done() callback to end. so if you add a temporary done() after the first call, you will see what actually fails... in my case my action has a json stringified as a parameter but i gave a actual json in my test, so it was failing on JSON.parse(object),

AdrianHL wrote this answer on 2019-02-14

I'm trying to use moxios.wait within another moxios.wait and I'm getting

Error: done() called multiple times

More Details About Repo
Owner Name axios
Repo Name moxios
Full Name axios/moxios
Language JavaScript
Created Date 2016-05-25
Updated Date 2022-12-05
Star Count 1386
Watcher Count 20
Fork Count 85
Issue Count 19


Issue Title Created Date Updated Date