mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
fixes
This commit is contained in:
@@ -114,8 +114,8 @@ import BigNumber from './path/to/bignumber.mjs';
|
|||||||

|

|
||||||
|
|
||||||
Currently every external is loaded once and cached until Leporello is restarted
|
Currently every external is loaded once and cached until Leporello is restarted
|
||||||
(TODO what happens if we load modules in iframe and then recreate iframe)
|
(TODO change path to modules every time it changed on disk, since modules are
|
||||||
(TODO serve modules from service worker, change host every time)
|
served from service workers).
|
||||||
|
|
||||||
## Hotkeys
|
## Hotkeys
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ type Node = ToplevelCall | Call
|
|||||||
|
|
||||||
// TODO just export const Iframe_Function?
|
// TODO just export const Iframe_Function?
|
||||||
const make_function = (...args) => {
|
const make_function = (...args) => {
|
||||||
if(globalThis.process != null) {
|
if(globalThis.run_window == null) {
|
||||||
// Tests are run in Node.js
|
// Code is executed in test env
|
||||||
return new Function(...args)
|
return new Function(...args)
|
||||||
} else {
|
} else {
|
||||||
// Code run in browser and user opened run_window
|
// Code run in browser and user opened run_window
|
||||||
|
|||||||
@@ -2241,14 +2241,16 @@ const y = x()`
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
test('get_initial_state toplevel not entrypoint', () => {
|
test('get_initial_state toplevel not entrypoint', () => {
|
||||||
const s = COMMANDS.get_initial_state({
|
const s = test_initial_state(
|
||||||
files: {
|
{
|
||||||
'' : `import {x} from 'x'; x()`,
|
'' : `import {x} from 'x'; x()`,
|
||||||
'x' : `export const x = () => 1; x()`,
|
'x' : `export const x = () => 1; x()`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
entrypoint: '',
|
entrypoint: '',
|
||||||
current_module: 'x',
|
current_module: 'x',
|
||||||
})
|
}
|
||||||
|
)
|
||||||
assert_equal(s.current_calltree_node.toplevel, true)
|
assert_equal(s.current_calltree_node.toplevel, true)
|
||||||
assert_equal(s.active_calltree_node, null)
|
assert_equal(s.active_calltree_node, null)
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -28,14 +28,16 @@ export const assert_code_error = (codestring, error) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const test_initial_state = (code, state) => {
|
export const test_initial_state = (code, state) => {
|
||||||
return COMMANDS.get_initial_state(
|
return COMMANDS.open_run_window(
|
||||||
|
COMMANDS.get_initial_state(
|
||||||
{
|
{
|
||||||
...state,
|
|
||||||
files: typeof(code) == 'object' ? code : { '' : code},
|
files: typeof(code) == 'object' ? code : { '' : code},
|
||||||
entrypoint: '',
|
entrypoint: '',
|
||||||
current_module: '',
|
current_module: '',
|
||||||
|
...state,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const stringify = val =>
|
export const stringify = val =>
|
||||||
|
|||||||
Reference in New Issue
Block a user