Skip to content

Commit 4204bc3

Browse files
authored
[test] Add test of rollup using node in test_other. NFC (emscripten-core#23708)
This complements the existing browser test in `test_browser.py`.
1 parent bb7fd25 commit 4204bc3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

test/rollup_node/index.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Module from './hello.mjs';
2+
3+
await Module();
4+
5+
console.log('done');

test/rollup_node/rollup.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
input: 'index.mjs',
3+
output: {
4+
file: 'bundle.mjs',
5+
format: 'es'
6+
}
7+
};

test/test_other.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15697,3 +15697,10 @@ def test_late_module_api_assignment(self):
1569715697
create_file('post.js', f'Module.{prop} = () => console.log("will never fire since assigned too late")')
1569815698
expected = f"Aborted(Attempt to set `Module.{prop}` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js')"
1569915699
self.do_runf(test_file('hello_world.c'), expected, emcc_args=['--post-js=post.js', '-sWASM_ASYNC_COMPILATION=0'], assert_returncode=NON_ZERO)
15700+
15701+
def test_rollup(self):
15702+
shutil.copytree(test_file('rollup_node'), 'rollup_node')
15703+
with common.chdir('rollup_node'):
15704+
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sEXIT_RUNTIME', '-sENVIRONMENT=node', '-sMODULARIZE', '-o', 'hello.mjs'])
15705+
self.run_process(shared.get_npm_cmd('rollup') + ['--config'])
15706+
self.assertContained('hello, world!', self.run_js('bundle.mjs'))

0 commit comments

Comments
 (0)