Skip to content

Commit

Permalink
Update default minimum Node.js version in generated JS to 16.0.0 (#19192
Browse files Browse the repository at this point in the history
)

This version of node supports wasm-bigint by default, so it will help #19156

Node 16 is over 2 years old, and the node website already provides newer versions
both for latest and for LTS. 

This is possible after emscripten-core/emsdk#829 made
the emsdk install a 15.x version by default, and then
emscripten-core/emsdk#1232 switched to 16.x.
  • Loading branch information
kripken committed Jun 21, 2023
1 parent d25f32e commit df1f6f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ See docs/process.md for more on how version tagging works.

3.1.42 (in development)
-----------------------
- The default minimum Node version of Emscripten output was bumped from 10.19 to
16.0. To run the output JS in an older version of node, you can use e.g.
`-sMIN_NODE_VERSION=101900` which will apply the previous minimum version of
10.19.0. (#19192).
- The log message that emcc will sometime print (for example when auto-building
system libraries) can now be completely supressed by running with
`EMCC_LOGGING=0`.
Expand Down
2 changes: 1 addition & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ var MIN_CHROME_VERSION = 75;
// distinct from the minimum version required run the emscripten compiler.
// This version aligns with the current Ubuuntu TLS 20.04 (Focal).
// Version is encoded in MMmmVV, e.g. 1814101 denotes Node 18.14.01.
var MIN_NODE_VERSION = 101900;
var MIN_NODE_VERSION = 160000;

// Tracks whether we are building with errno support enabled. Set to 0
// to disable compiling errno support in altogether. This saves a little
Expand Down
1 change: 1 addition & 0 deletions test/other/test_INCOMING_MODULE_JS_API.js.size
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4305
16 changes: 9 additions & 7 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -10646,7 +10646,9 @@ def test(args):
# Changing this option to [] should decrease code size.
self.assertLess(changed, normal)
# Check an absolute code size as well, with some slack.
self.assertLess(abs(changed - 4491), 150)
self.check_expected_size_in_file('js',
test_file('other/test_INCOMING_MODULE_JS_API.js.size'),
changed)

def test_INCOMING_MODULE_JS_API_missing(self):
create_file('pre.js', '''
Expand Down Expand Up @@ -12362,22 +12364,22 @@ def test_node_unhandled_rejection(self):

# With NODEJS_CATCH_REJECTION we expect the unhandled rejection to cause a non-zero
# exit code and log the stack trace correctly.
self.run_process([EMCC, '--pre-js=pre.js', '-sNODEJS_CATCH_REJECTION', 'main.c'])
output = self.run_js('a.out.js', assert_returncode=NON_ZERO)
self.assertContained('unhandledRejection', read_file('a.out.js'))
self.build('main.c', emcc_args=['--pre-js=pre.js', '-sNODEJS_CATCH_REJECTION'])
output = self.run_js('main.js', assert_returncode=NON_ZERO)
self.assertContained('unhandledRejection', read_file('main.js'))
self.assertContained('ReferenceError: missing is not defined', output)
self.assertContained('at foo (', output)

# Without NODEJS_CATCH_REJECTION we expect node to log the unhandled rejection
# but return 0.
self.node_args = [a for a in self.node_args if '--unhandled-rejections' not in a]
self.run_process([EMCC, '--pre-js=pre.js', '-sNODEJS_CATCH_REJECTION=0', 'main.c'])
self.assertNotContained('unhandledRejection', read_file('a.out.js'))
self.build('main.c', emcc_args=['--pre-js=pre.js', '-sNODEJS_CATCH_REJECTION=0'])
self.assertNotContained('unhandledRejection', read_file('main.js'))

if shared.check_node_version()[0] >= 15:
self.skipTest('old behaviour of node JS cannot be tested on node v15 or above')

output = self.run_js('a.out.js')
output = self.run_js('main.js')
self.assertContained('ReferenceError: missing is not defined', output)
self.assertContained('at foo (', output)

Expand Down

0 comments on commit df1f6f7

Please sign in to comment.