JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q24897F
  • License MIT

A gulp task that waits until a condition is met or until timeout.

Package Exports

  • gulp-waitfor

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-waitfor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-waitfor

A gulp task that waits until a condition is met or until timeout.

Example

The following gulp example will start a wiremock server and delay the jasmine tests until wiremock is finished booting.

var gulp = require('gulp');
var waitFor = require('gulp-waitfor');
var request = require('request');

gulp.task('run-e2e', function () {
    return gulp
        .exec('java -jar ./lib/wiremock-standalone.jar --your-options')
        .pipe(waitFor(function (cb) {
            request('http://localhost:1235/service/your-mock-service', function (error, response) {
                cb(!error && response.statusCode === 200);
            });
        }))
        .pipe(... /* run jasmine tests or simply got to the next task */);
});

Options

There are two ways to invoke gulp-waitfor:

Basic:

waitFor(function(cb) { /* cb(condition satisfied boolean)  */}, [timeoutMs], [intervalMs])

Config object:

waitFor({
  before: function() { },
  condition: function(cb) { /* cb(condition satisfied boolean)  */},
  after: function(succes) { },
  interval: 500ms, // default is 500
  timeout: 60000ms, // default is 1 minute
  verbose: false, // default is true (false silences logging)
})