diff --git a/src/eval.js b/src/eval.js index c8a31fa..19a27a4 100644 --- a/src/eval.js +++ b/src/eval.js @@ -331,8 +331,6 @@ export const eval_modules = ( // TODO use native array for stack for perf? stack contains booleans stack: new Array(), - logs: [], - searched_location: location, found_call: null, diff --git a/src/runtime.js b/src/runtime.js index bc39123..b5822b8 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -44,10 +44,12 @@ const do_run = function*(module_fns, cxt, io_trace){ cxt = (io_trace == null || io_trace.length == 0) // TODO group all io_trace_ properties to single object? ? {...cxt, + logs: [], io_trace_is_recording: true, io_trace: [], } : {...cxt, + logs: [], io_trace_is_recording: false, io_trace, io_trace_is_replay_aborted: false, diff --git a/test/test.js b/test/test.js index 381f99b..290732a 100644 --- a/test/test.js +++ b/test/test.js @@ -3444,4 +3444,15 @@ const y = x()` patch_builtin('fetch', null) }), + + test('record io logs recorded twice bug', () => { + const code = `Math.random()` + const i = test_initial_state(code) + const second = COMMANDS.input( + i, + `console.log(1); Math.random(); Math.random()`, + 0 + ) + assert_equal(second.state.logs.logs.length, 1) + }) ]