(gen)
| 7 | const co = require('co'); |
| 8 | |
| 9 | const wrapJasmine = function(gen) { |
| 10 | const arity = gen.length; |
| 11 | const fn = co.wrap(gen); |
| 12 | return function(done) { |
| 13 | // Run the wrapped, Promise returning test function |
| 14 | return fn.apply(this, arity === 0 ? [] : [done]) |
| 15 | |
| 16 | // Finish the test if it doesn't include a 'done' argument |
| 17 | .then(function() { if (arity === 0) { return done(); } }) |
| 18 | |
| 19 | // Fail on runtime error |
| 20 | .catch(err => done.fail(err)); |
| 21 | }; |
| 22 | }; |
| 23 | |
| 24 | module.exports = { |
| 25 | wrapJasmine |
no test coverage detected