From 19815dbb4df57d705c5bf8b6bd60accdc3de1e8b Mon Sep 17 00:00:00 2001 From: mmcw-dev Date: Wed, 20 Dec 2017 21:59:30 -0500 Subject: [PATCH] Log step sequence to keep track during tests. OFF BY ONE! OFF BY ONE! --- lib/sequence/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/sequence/index.js b/lib/sequence/index.js index 857fb58..2461aa7 100644 --- a/lib/sequence/index.js +++ b/lib/sequence/index.js @@ -59,6 +59,7 @@ sequence.stop = function () { if (sequence._state.stop) sequence._state.stop() if (sequence._state.input) sequence._state.input() + sequence._state.stop = null sequence._state.input = null } @@ -73,25 +74,26 @@ sequence.resume = function () { } sequence.step = function () { + log.info('step', `Started step ${sequence._state.count}`) if (sequence._state.active && !sequence._state.paused) { if (sequence._state.arr.length > 0) { - if (sequence._state.count > sequence._state.arr.length) { + if (sequence._state.count > sequence._state.arr.length - 1) { return sequence.stop() } - log.info('step') + log.info('step', sequence._state.count) return sequence._state.arr[sequence._state.count](() => { sequence._state.count++ sequence.step() }) } else if (sequence._loop.arr.length > 0) { - if (sequence._state.count > sequence._loop.arr.length) { + if (sequence._state.count > sequence._loop.arr.length - 1) { sequence._state.count = 0 sequence._loop.count++ } if (sequence._loop.max > 0 && sequence._loop.count > sequence._loop.max) { return sequence.stop() } - log.info() + log.info('step', sequence._state.count) return sequence._loop.arr[sequence._state.count](() => { sequence._state.count++ sequence.step()