UNPKG

arrange-act-assert

Version:

The lightweight "Act-Arrange-Assert" oriented testing framework

28 lines (27 loc) 560 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.functionRunner = functionRunner; async function functionRunner(type, cb, args) { if (!cb) { return { run: false, data: undefined }; } try { const res = await cb(...args); return { run: true, ok: true, data: res }; } catch (e) { return { run: true, ok: false, error: e, type: type }; } }