@gleif-it/vlei-verifier-workflows
Version:
Workflows for vLEI users and vLEI credentials for the vLEI-verifier service
24 lines (23 loc) • 727 B
JavaScript
/**
* Provides a way to group logically related test steps in an integration test
*
* Can be useful to provide logging when a step succeeds, or to be able to use
* locally scoped variables.
*
* In long tests it can also be useful to create visual groups.
* @param description
* @param fn
* @returns
*/
export async function step(description, fn) {
try {
const start = Date.now();
const response = await fn();
// Bypassing console.log to avoid the verbose log output from jest
process.stdout.write(`Step - ${description} - finished (${Date.now() - start}ms)\n`);
return response;
}
catch (_error) {
throw new Error(`Step - ${description} - failed`);
}
}