How to use the @testdeck/core.wrap function in @testdeck/core

To help you get started, we’ve selected a few @testdeck/core 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 testdeck / testdeck / packages / @testdeck / mocha / index.ts View on Github external
function applyTimings(fn: any, settings: any): any {
  if (settings) {
    if (fn.length === 1) {
      return core.wrap(function(done) {
        if (settings.retries !== undefined) { this.retries(settings.retries); }
        if (settings.slow !== undefined) { this.slow(settings.slow); }
        if (settings.timeout !== undefined) { this.timeout(settings.timeout); }
        return fn.call(this, done);
      }, fn);
    } else {
      return core.wrap(function() {
        if (settings.retries !== undefined) { this.retries(settings.retries); }
        if (settings.slow !== undefined) { this.slow(settings.slow); }
        if (settings.timeout !== undefined) { this.timeout(settings.timeout); }
        return fn.call(this);
      }, fn);
    }
  } else {
    return fn;
  }
}

@testdeck/core

Core framework for decorator based object oriented testing

Apache-2.0
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Popular @testdeck/core functions