Skip to content

Commit 8d20b32

Browse files
authored
[test] Update rollup and webpack tests to reflect lack of wasm bundling. NFC (emscripten-core#23931)
1 parent b4f7e9f commit 8d20b32

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

test/rollup/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<html>
22
<body>
33
<hr><div id='output'></div><hr>
4-
<script type="module" src="./bundle.mjs"></script>
4+
<script type="module" src="./dist/bundle.mjs"></script>
55
</body>
66
</html>

test/rollup/rollup.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
input: 'index.mjs',
33
output: {
4-
file: 'bundle.mjs',
4+
file: 'dist/bundle.mjs',
55
format: 'es'
66
}
77
};

test/rollup_node/rollup.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
input: 'index.mjs',
33
output: {
4-
file: 'bundle.mjs',
4+
file: 'dist/bundle.mjs',
55
format: 'es'
66
}
77
};

test/test_browser.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -5593,21 +5593,26 @@ def test_webpack(self, es6):
55935593
outfile = 'src/hello.js'
55945594
self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web,worker', '-o', outfile])
55955595
self.run_process(shared.get_npm_cmd('webpack') + ['--mode=development', '--no-devtool'])
5596+
# Webpack doesn't bundle the wasm file by default so we need to copy it
5597+
# TODO(sbc): Look into plugins that do bundling.
55965598
shutil.copy('src/hello.wasm', 'dist/')
55975599
self.run_browser('dist/index.html', '/report_result?exit:0')
55985600

55995601
@also_with_threads
56005602
def test_vite(self):
56015603
copytree(test_file('vite'), '.')
5602-
self.compile_btest('hello_world.c', ['-sEXPORT_ES6', '-sEXIT_RUNTIME', '-sMODULARIZE', '-sENVIRONMENT=web,worker', '-o', 'hello.mjs'])
5604+
self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-sENVIRONMENT=web,worker', '-o', 'hello.mjs'])
56035605
self.run_process(shared.get_npm_cmd('vite') + ['build'])
56045606
self.run_browser('dist/index.html', '/report_result?exit:0')
56055607

56065608
@also_with_threads
56075609
def test_rollup(self):
56085610
copytree(test_file('rollup'), '.')
5609-
self.compile_btest('hello_world.c', ['-sEXPORT_ES6', '-sEXIT_RUNTIME', '-sMODULARIZE', '-o', 'hello.mjs'])
5611+
self.compile_btest('hello_world.c', ['-sEXIT_RUNTIME', '-o', 'hello.mjs'])
56105612
self.run_process(shared.get_npm_cmd('rollup') + ['--config'])
5613+
# Rollup doesn't bundle the wasm file by default so we need to copy it
5614+
# TODO(sbc): Look into plugins that do bundling.
5615+
shutil.copy('hello.wasm', 'dist/')
56115616
self.run_browser('index.html', '/report_result?exit:0')
56125617

56135618

test/test_other.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -15861,7 +15861,10 @@ def test_rollup(self):
1586115861
copytree(test_file('rollup_node'), '.')
1586215862
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sEXIT_RUNTIME', '-sENVIRONMENT=node', '-sMODULARIZE', '-o', 'hello.mjs'])
1586315863
self.run_process(shared.get_npm_cmd('rollup') + ['--config'])
15864-
self.assertContained('hello, world!', self.run_js('bundle.mjs'))
15864+
# Rollup doesn't bundle the wasm file by default so we need to copy it
15865+
# TODO(sbc): Look into plugins that do bundling.
15866+
shutil.copy('hello.wasm', 'dist/')
15867+
self.assertContained('hello, world!', self.run_js('dist/bundle.mjs'))
1586515868

1586615869
def test_rlimit(self):
1586715870
self.do_other_test('test_rlimit.c', emcc_args=['-O1'])

0 commit comments

Comments
 (0)