How to use wait-on - 3 common examples

To help you get started, we’ve selected a few wait-on examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github universal-vue / uvue / tests / utils / cli.js View on Github external
const waitOnPromise = options => new Promise(resolve => waitOn(options, resolve));
const wait = time => new Promise(resolve => setTimeout(resolve, time));
github smooth-code / jest-puppeteer / packages / jest-dev-server / src / global.js View on Github external
const { launchTimeout, protocol, host, port, waitOnScheme } = config

    let url = ''
    if (protocol === 'tcp' || protocol === 'socket') {
      url = `${protocol}:${host}:${port}`
    } else {
      url = `${protocol}://${host}:${port}`
    }
    const opts = {
      resources: [url],
      timeout: launchTimeout,
      ...waitOnScheme,
    }

    try {
      await waitOn(opts)
    } catch (err) {
      throw new JestDevServerError(
        `Server has taken more than ${launchTimeout}ms to start.`,
        ERROR_TIMEOUT,
      )
    }
  }
}
github universal-vue / uvue / packages / @uvue / devtools / cli / utils.js View on Github external
new Promise((resolve, reject) =>
    waitOn(options, err => {
      if (err) return reject(err);
      resolve();
    }),
  );

wait-on

wait-on is a cross platform command line utility and Node.js API which will wait for files, ports, sockets, and http(s) resources to become available

MIT
Latest version published 3 months ago

Package Health Score

82 / 100
Full package analysis

Popular wait-on functions