(spec, pre, post, finalize, defaultDelay)
| 97 | }, null), 200 /*default timeout delay*/) |
| 98 | |
| 99 | function test(spec, pre, post, finalize, defaultDelay) { |
| 100 | if (hasOwn.call(spec, "\x01specTimeout")) defaultDelay = spec["\x01specTimeout"] |
| 101 | pre = [].concat(pre, spec["\x01beforeEach"] || []) |
| 102 | post = [].concat(spec["\x01afterEach"] || [], post) |
| 103 | series([].concat(spec["\x01before"] || [], Object.keys(spec).reduce(function(tasks, key) { |
| 104 | if (key.charCodeAt(0) !== 1 && (only.length === 0 || only.indexOf(spec[key].fn) !== -1 || !(spec[key] instanceof Task))) { |
| 105 | tasks.push(new Task(function(done) { |
| 106 | o.timeout(Infinity) |
| 107 | subjects.push(key) |
| 108 | var pop = new Task(function pop() {subjects.pop(), done()}, null) |
| 109 | if (spec[key] instanceof Task) series([].concat(pre, spec[key], post, pop), defaultDelay) |
| 110 | else test(spec[key], pre, post, pop, defaultDelay) |
| 111 | }, null)) |
| 112 | } |
| 113 | return tasks |
| 114 | }, []), spec["\x01after"] || [], finalize), defaultDelay) |
| 115 | } |
| 116 | |
| 117 | function series(tasks, defaultDelay) { |
| 118 | var cursor = 0 |
no test coverage detected