effects-as-data
Advanced tools
Comparing version 2.12.1 to 2.12.2
'use strict'; | ||
var _marked = [singleLine, yieldArray, rethrow, throwFoo, returnCmdResult, throwSemantic].map(regeneratorRuntime.mark); | ||
var _marked = [singleLine, yieldArray, rethrow, throwFoo, throwImmediately, returnCmdResult, throwSemantic].map(regeneratorRuntime.mark); | ||
@@ -308,2 +308,22 @@ var _require = require('./effects'), | ||
function throwImmediately() { | ||
return regeneratorRuntime.wrap(function throwImmediately$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
throw new Error('oops!'); | ||
case 1: | ||
case 'end': | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _marked[4], this); | ||
} | ||
test('testFn semantic should handle errors thrown immediately', testFn(throwImmediately, function () { | ||
// prettier-ignore | ||
return args().throws(new Error('oops!')); | ||
})); | ||
test('testFn semantic should handle errors without returns (badHandler)', testFn(badHandler, function () { | ||
@@ -357,18 +377,18 @@ // prettier-ignore | ||
function returnCmdResult() { | ||
return regeneratorRuntime.wrap(function returnCmdResult$(_context6) { | ||
return regeneratorRuntime.wrap(function returnCmdResult$(_context7) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
switch (_context7.prev = _context7.next) { | ||
case 0: | ||
_context6.next = 2; | ||
_context7.next = 2; | ||
return cmds.echo('foo'); | ||
case 2: | ||
return _context6.abrupt('return', _context6.sent); | ||
return _context7.abrupt('return', _context7.sent); | ||
case 3: | ||
case 'end': | ||
return _context6.stop(); | ||
return _context7.stop(); | ||
} | ||
} | ||
}, _marked[4], this); | ||
}, _marked[5], this); | ||
} | ||
@@ -385,11 +405,11 @@ | ||
var value; | ||
return regeneratorRuntime.wrap(function throwSemantic$(_context7) { | ||
return regeneratorRuntime.wrap(function throwSemantic$(_context8) { | ||
while (1) { | ||
switch (_context7.prev = _context7.next) { | ||
switch (_context8.prev = _context8.next) { | ||
case 0: | ||
_context7.next = 2; | ||
_context8.next = 2; | ||
return cmds.echo('foo'); | ||
case 2: | ||
value = _context7.sent; | ||
value = _context8.sent; | ||
throw new Error('oops'); | ||
@@ -399,6 +419,6 @@ | ||
case 'end': | ||
return _context7.stop(); | ||
return _context8.stop(); | ||
} | ||
} | ||
}, _marked[5], this); | ||
}, _marked[6], this); | ||
} | ||
@@ -405,0 +425,0 @@ |
@@ -124,3 +124,7 @@ 'use strict'; | ||
var t = [[fnArgs]]; | ||
return { yieldCmd: yieldCmd(t), returns: returns(t) }; | ||
return { | ||
yieldCmd: yieldCmd(t), | ||
throws: throwAfterCmdReturns(t), | ||
returns: returns(t) | ||
}; | ||
}; | ||
@@ -127,0 +131,0 @@ |
{ | ||
"name": "effects-as-data", | ||
"version": "2.12.1", | ||
"version": "2.12.2", | ||
"description": "A micro abstraction layer for Javascript that makes writing, testing, and monitoring side-effects easy.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -399,3 +399,16 @@ const { functions, cmds } = require('./effects') | ||
function* throwImmediately() { | ||
throw new Error('oops!') | ||
} | ||
test( | ||
'testFn semantic should handle errors thrown immediately', | ||
testFn(throwImmediately, () => { | ||
// prettier-ignore | ||
return args() | ||
.throws(new Error('oops!')) | ||
}) | ||
) | ||
test( | ||
'testFn semantic should handle errors without returns (badHandler)', | ||
@@ -402,0 +415,0 @@ testFn(badHandler, () => { |
@@ -116,3 +116,7 @@ const assert = require('assert') | ||
const t = [[fnArgs]] | ||
return { yieldCmd: yieldCmd(t), returns: returns(t) } | ||
return { | ||
yieldCmd: yieldCmd(t), | ||
throws: throwAfterCmdReturns(t), | ||
returns: returns(t) | ||
} | ||
} | ||
@@ -119,0 +123,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236720
3834