diff --git a/test/self_hosted_test.js b/test/self_hosted_test.js index 0e1bdc0..d3f4dca 100644 --- a/test/self_hosted_test.js +++ b/test/self_hosted_test.js @@ -70,12 +70,19 @@ console.time('run') const i = test_initial_state( {}, // files undefined, - {project_dir: dir}, - {entrypoint: 'test/run.js'}, + { + project_dir: dir, + entrypoint: 'test/run.js', + } ) if(!i.parse_result.ok) { console.error('Parse errors:', i.parse_result.problems) + i.parse_result.problems.forEach(p => { + if(p.index != null) { + console.error(p.module + ': ' + p.message + ' at ' + i.files[p.module].slice(p.index, p.index + 80)) + } + }) throw new Error('parse error') } diff --git a/test/test.js b/test/test.js index 36a9e1e..3a4a799 100644 --- a/test/test.js +++ b/test/test.js @@ -3320,9 +3320,7 @@ const y = x()` 'x' : `export const x = () => 1; x()`, }, undefined, - undefined, { - entrypoint: '', current_module: 'x', } ) diff --git a/test/utils.js b/test/utils.js index 26e0c78..126123a 100644 --- a/test/utils.js +++ b/test/utils.js @@ -98,20 +98,27 @@ export const assert_code_error_async = async (codestring, error) => { assert_equal(result.error, error) } -export const test_initial_state = (code, cursor_pos, other, entrypoint_settings) => { +export const test_initial_state = (code, cursor_pos, options = {}) => { if(cursor_pos < 0) { throw new Error('illegal cursor_pos') } + const { + //entrypoint = '', + current_module, + project_dir, + on_deferred_call, + } = options + const entrypoint = options.entrypoint ?? '' return COMMANDS.open_app_window( COMMANDS.get_initial_state( { files: typeof(code) == 'object' ? code : { '' : code}, - ...other + project_dir, + on_deferred_call, }, { - entrypoint: '', - current_module: '', - ...entrypoint_settings, + entrypoint, + current_module: current_module ?? '', }, cursor_pos ),