@kev_nz/async-tools
Advanced tools
Comparing version
{ | ||
"name": "@kev_nz/async-tools", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "Async tools - a collection of utility functions for working with async/await code.", | ||
@@ -11,2 +11,3 @@ "main": "src/index.js", | ||
"test": "jest ./src/__tests__/*.test.js", | ||
"test:ci": "jest ./src/__tests__/*.test.js --reporters=jest-junit", | ||
"cover": "jest ./src/__tests__/*.test.js --coverage", | ||
@@ -49,6 +50,17 @@ "coverage": "jest ./src/__tests__/*.test.js --coverage --coverageReporters=text-lcov | coveralls", | ||
"jest": "^24.6.0", | ||
"jest-junit": "^10.0.0", | ||
"jsdoc": "^3.6.3", | ||
"jsdoc-to-markdown": "^5.0.0", | ||
"minami": "^1.2.3" | ||
}, | ||
"jest-junit": { | ||
"suiteName": "jest tests", | ||
"outputDirectory": "./reports", | ||
"outputName": "junit.xml", | ||
"uniqueOutputName": "false", | ||
"classNameTemplate": "{classname}-{title}", | ||
"titleTemplate": "{classname}-{title}", | ||
"ancestorSeparator": " › ", | ||
"usePathForSuiteName": "true" | ||
} | ||
} |
@@ -31,2 +31,5 @@ const composer = require('../composer') | ||
} | ||
const errorFunc = () => { | ||
throw new Error('The Error') | ||
} | ||
it('should take 3 functions as parameters and execute them on a value', async () => { | ||
@@ -42,3 +45,11 @@ const chain = await composer(asyncFunc1, asyncFunc2, asyncFunc3) | ||
}) | ||
it('should throw when function errors', async () => { | ||
try { | ||
const chain = composer(func1, func2, errorFunc, func2) | ||
await chain('dude') | ||
} catch (err) { | ||
expect(err.name).toBe('Error') | ||
} | ||
}) | ||
const heldFunction1 = async (val, other) => { | ||
@@ -45,0 +56,0 @@ await delay(5) |
@@ -29,4 +29,8 @@ /** | ||
} | ||
const result = await el.value(total) | ||
next(result) | ||
try { | ||
const result = await el.value(total) | ||
next(result) | ||
} catch (error) { | ||
return reject(error) | ||
} | ||
} | ||
@@ -33,0 +37,0 @@ |
25348
3.17%634
2.42%9
12.5%