@@ -359,7 +359,7 @@ def test_emcc_generate_config(self, compiler):
359
359
'': ([],),
360
360
'node': (['-sENVIRONMENT=node'],),
361
361
})
362
- def test_emcc_output_mjs (self, args):
362
+ def test_esm (self, args):
363
363
self.run_process([EMCC, '-o', 'hello_world.mjs',
364
364
'--extern-post-js', test_file('modularize_post_js.js'),
365
365
test_file('hello_world.c')] + args)
@@ -372,7 +372,7 @@ def test_emcc_output_mjs(self, args):
372
372
'node': (['-sENVIRONMENT=node'],),
373
373
})
374
374
@node_pthreads
375
- def test_emcc_output_worker_mjs (self, args):
375
+ def test_esm_worker (self, args):
376
376
os.mkdir('subdir')
377
377
self.run_process([EMCC, '-o', 'subdir/hello_world.mjs',
378
378
'-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-pthread', '-O1',
@@ -385,7 +385,7 @@ def test_emcc_output_worker_mjs(self, args):
385
385
self.assertContained('hello, world!', self.run_js('subdir/hello_world.mjs'))
386
386
387
387
@node_pthreads
388
- def test_emcc_output_worker_mjs_single_file (self):
388
+ def test_esm_worker_single_file (self):
389
389
self.run_process([EMCC, '-o', 'hello_world.mjs', '-pthread',
390
390
'--extern-post-js', test_file('modularize_post_js.js'),
391
391
test_file('hello_world.c'), '-sSINGLE_FILE'])
@@ -394,40 +394,23 @@ def test_emcc_output_worker_mjs_single_file(self):
394
394
self.assertContained("new Worker(new URL('hello_world.mjs', import.meta.url), {", src)
395
395
self.assertContained('hello, world!', self.run_js('hello_world.mjs'))
396
396
397
- def test_emcc_output_mjs_closure (self):
397
+ def test_esm_closure (self):
398
398
self.run_process([EMCC, '-o', 'hello_world.mjs',
399
399
'--extern-post-js', test_file('modularize_post_js.js'),
400
400
test_file('hello_world.c'), '--closure=1'])
401
401
src = read_file('hello_world.mjs')
402
402
self.assertContained('new URL("hello_world.wasm", import.meta.url)', src)
403
403
self.assertContained('hello, world!', self.run_js('hello_world.mjs'))
404
404
405
- def test_export_es6_implies_modularize (self):
405
+ def test_esm_implies_modularize (self):
406
406
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6'])
407
407
src = read_file('a.out.js')
408
408
self.assertContained('export default Module;', src)
409
409
410
- def test_export_es6_requires_modularize (self):
410
+ def test_esm_requires_modularize (self):
411
411
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sMODULARIZE=0'])
412
412
self.assertContained('EXPORT_ES6 requires MODULARIZE to be set', err)
413
413
414
- @parameterized({
415
- '': ([],),
416
- # load a worker before startup to check ES6 modules there as well
417
- 'pthreads': (['-pthread', '-sPTHREAD_POOL_SIZE=1'],),
418
- })
419
- def test_export_es6(self, args):
420
- self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6',
421
- '-o', 'hello.mjs'] + args)
422
- # In ES6 mode we use MODULARIZE, so we must instantiate an instance of the
423
- # module to run it.
424
- create_file('runner.mjs', '''
425
- import Hello from "./hello.mjs";
426
- Hello();
427
- ''')
428
-
429
- self.assertContained('hello, world!', self.run_js('runner.mjs'))
430
-
431
414
@parameterized({
432
415
'': ([],),
433
416
'pthreads': (['-pthread'],),
0 commit comments