mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
fix bug
This commit is contained in:
@@ -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,
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
11
test/test.js
11
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)
|
||||
})
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user