tests/utils/sleep.js
/**
 * Convert a setTimeout to a Promise.
 *
 * You can use it to have a much more readable blocking code with async/await
 * in some asynchronous tests.
 *
 * @param {number} timeInMs
 * @returns {Promise}
 */
Convert a setTimeout to a Promise.
You can use it to have a much more readable blocking code with async/await
in some asynchronous tests.

@param {number} timeInMs
@returns {Promise}
Convert a setTimeout to a Promise . You can use it to have a much more readable blocking code with async / await in some asynchronous tests . @param { number } timeInMs @returns { Promise }
function sleep(timeInMs) {
  return new Promise((res) => {
    setTimeout(res, timeInMs);
  });
}
function sleep ( timeInMs ) { return new Promise ( ( res ) => { setTimeout ( res , timeInMs ) ; } ) ; }
Convert a setTimeout to a Promise.
Convert a setTimeout to a Promise .