Skip to content

Commit ca2b854

Browse files
authored
Fix other.test_output_name_collision after recent node upgrade (#24447)
New versions of node cannot run `hello.wasm` even if the file contains JS: ``` TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".wasm" for /usr/local/google/home/sbc/dev/wasm/emscripten/out/test/hello.wasm at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:183:9) at defaultGetFormat (node:internal/modules/esm/get_format:209:36) at defaultLoad (node:internal/modules/esm/load:119:22) at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:590:32) at async #link (node:internal/modules/esm/module_job:141:19) { code: 'ERR_UNKNOWN_FILE_EXTENSION' } ``` I'm not sure if this should be considered a bug or not.
1 parent 0340809 commit ca2b854

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/test_other.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13806,7 +13806,11 @@ def test_output_name_collision(self):
1380613806
self.run_process([EMCC, '-o', 'hello.wasm', '--oformat=js', test_file('hello_world.c')])
1380713807
self.assertExists('hello.wasm')
1380813808
self.assertExists('hello_.wasm')
13809-
self.assertContained('hello, world!', self.run_js('hello.wasm'))
13809+
self.assertFalse(building.is_wasm('hello.wasm'))
13810+
self.assertTrue(building.is_wasm('hello_.wasm'))
13811+
# Node cannot actually run the generated JS if it's in a file with the .wasm extension
13812+
os.rename('hello.wasm', 'hello.js')
13813+
self.assertContained('hello, world!', self.run_js('hello.js'))
1381013814

1381113815
def test_main_module_no_undefined(self):
1381213816
# Test that ERROR_ON_UNDEFINED_SYMBOLS works with MAIN_MODULE.

0 commit comments

Comments
 (0)