This commit is contained in:
Dmitry Vasilev
2023-07-28 20:31:38 +03:00
parent 33a3a53984
commit e3ccdaafc6
3 changed files with 13 additions and 2 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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)
})
]