@@ -234,12 +234,24 @@ def test_emcc_generate_config(self):
234234 os .remove (config_path )
235235
236236 def test_emcc_output_mjs (self ):
237- self .run_process ([EMCC , '-o' , 'hello_world.mjs' , test_file ('hello_world.c' )])
237+ # FIXME: https://github.com/emscripten-core/emscripten/issues/11792
238+ create_file ('extern-pre.js' , '''
239+ import { dirname } from "path";
240+ import { fileURLToPath } from "url";
241+ import { createRequire } from "module";
242+ const require = createRequire(import.meta.url);
243+ const __dirname = dirname(fileURLToPath(import.meta.url));
244+ ''' )
245+ # FIXME: locateFile hook should not be necessary
246+ create_file ('extern-post.js' , '''
247+ await Module({ locateFile: (fileName, scriptDirectory) => scriptDirectory + fileName });
248+ ''' )
249+ self .run_process ([EMCC , '-o' , 'hello_world.mjs' , test_file ('hello_world.c' ),
250+ '--extern-pre-js' , 'extern-pre.js' ,
251+ '--extern-post-js' , 'extern-post.js' ])
238252 output = read_file ('hello_world.mjs' )
239253 self .assertContained ('export default Module;' , output )
240- # TODO(sbc): Test that this is actually runnable. We currently don't have
241- # any tests for EXPORT_ES6 but once we do this should be enabled.
242- # self.assertContained('hello, world!', self.run_js('hello_world.mjs'))
254+ self .assertContained ('hello, world!' , self .run_js ('hello_world.mjs' ))
243255
244256 @parameterized ({
245257 '' : (True , [],),
0 commit comments