diff --git a/test/common.py b/test/common.py index b24747bb658ae..0f4e64aa975da 100644 --- a/test/common.py +++ b/test/common.py @@ -1150,7 +1150,7 @@ def add_on_exit(self, code): # libraries, for example def get_emcc_args(self, main_file=False, compile_only=False, asm_only=False): def is_ldflag(f): - return any(f.startswith(s) for s in ['-sENVIRONMENT=', '--pre-js=', '--post-js=']) + return any(f.startswith(s) for s in ['-sEXPORT_ES6', '-sPROXY_TO_PTHREAD', '-sENVIRONMENT=', '--pre-js=', '--post-js=']) args = self.serialize_settings(compile_only or asm_only) + self.emcc_args if asm_only: diff --git a/test/test_browser.py b/test/test_browser.py index 28bd72a0daaab..e668740a9dafb 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -5541,10 +5541,20 @@ def test_error_reporting(self): create_file('post.js', 'throw "foo";') self.btest('hello_world.c', args=['--post-js=post.js'], expected='exception:foo') - def test_webpack(self): - shutil.copytree(test_file('webpack'), 'webpack') + @parameterized({ + '': (False,), + 'es6': (True,), + }) + def test_webpack(self, es6): + if es6: + shutil.copytree(test_file('webpack_es6'), 'webpack') + self.emcc_args += ['-sEXPORT_ES6'] + outfile = 'src/hello.mjs' + else: + shutil.copytree(test_file('webpack'), 'webpack') + outfile = 'src/hello.js' with utils.chdir('webpack'): - self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web', '-o', 'src/hello.js']) + self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web', '-o', outfile]) self.run_process(shared.get_npm_cmd('webpack') + ['--mode=development', '--no-devtool']) shutil.copyfile('webpack/src/hello.wasm', 'webpack/dist/hello.wasm') self.run_browser('webpack/dist/index.html', '/report_result?exit:0') diff --git a/test/webpack_es6/dist/index.html b/test/webpack_es6/dist/index.html new file mode 100644 index 0000000000000..a5e8b18cf27c6 --- /dev/null +++ b/test/webpack_es6/dist/index.html @@ -0,0 +1,6 @@ + +
+