abbr / deasync

Turns async function into sync via JavaScript wrapper of Node event loop
MIT License
971 stars 73 forks source link

doesn't work with jest #156

Open its-dibo opened 3 years ago

its-dibo commented 3 years ago

when running the following code with node file.js it works, but when running the same code with jest it just runs continuously

  console.log('===1===');
  Promise.resolve().then((_data) => {
    console.log('===2===');
    data = _data;
    done = true;
  });
  deasync.loopWhile(() => !done);

console displays '====1===', but doesn't display '===2==='

victorreinor commented 2 years ago

I'm having the same problem, is there any way to solve this or is there a fix already?

shmuel-krakower commented 2 years ago

Same here, any workarounds are welcome

ttxs25830 commented 2 years ago

same on me

radiorz commented 1 year ago

any solution ?