This package has been deprecated

Author message:

This @cybernaut package is not developed any further. Please use the new @cybernaut/test package.

@cybernaut/engine

14.0.0 • Public • Published

@cybernaut/engine

Package Version Build Status Coverage Status

The heart of Cybernaut: An engine for reliably asserting/verifying conditions and for reliably performing actions.

Installation

npm install --save @cybernaut/engine

Compatible APIs

Usage example

const {Engine} = require('@cybernaut/engine/lib/Engine');

const {assert, perform, verify} = new Engine();

(async () => {
  await assert(anyCondition);

  await perform(anyAction);

  if (await verify(anyCondition)) {
    /* Do something ... */
  }
})().catch(error => {
  console.error(error);

  process.exit(1);
});

Note: This example uses language features of ECMAScript 2017. Particularly useful are async functions which are natively supported by Node.js 7.6.0 or later.

Type definitions

External imports

@cybernaut/engine/lib/Engine

import {Action} from '@cybernaut/types/lib/Action';
import {Condition} from '@cybernaut/types/lib/Condition';

export class Engine {
  public readonly retries: number;
  public readonly retryDelay: number;

  public constructor(retries: number = 4, retryDelay: number = 250);

  public assert(condition: Condition): Promise<void>;
  public perform<T>(action: Action<T>): Promise<T>;
  public verify(condition: Condition): Promise<boolean>;
}

Built by (c) Clemens Akens. Released under the terms of the MIT License.

Package Sidebar

Install

npm i @cybernaut/engine

Weekly Downloads

0

Version

14.0.0

License

MIT

Last publish

Collaborators

  • clebert