Skip to content

Commit 90b6030

Browse files
authored
Update MINIMUM_NODE_VERSION to 10.19.0 and add testing (#18465)
1 parent 529ad2c commit 90b6030

File tree

5 files changed

+55
-26
lines changed

5 files changed

+55
-26
lines changed

.circleci/config.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,30 @@ commands:
6969
- run:
7070
name: pip install
7171
command: << parameters.python >> -m pip install -r requirements-dev.txt
72-
setup-latest-node:
73-
description: "setup latest node"
72+
install-node-version:
73+
description: "install a specific version of node"
74+
parameters:
75+
node_version:
76+
description: "version of node to install"
77+
type: string
7478
steps:
7579
- run:
76-
name: setup latest node
80+
name: setup node v<< parameters.node_version >>
7781
command: |
7882
cd $HOME
79-
wget https://nodejs.org/dist/v19.0.0/node-v19.0.0-linux-x64.tar.xz
80-
tar xf node-v19.0.0-linux-x64.tar.xz
81-
echo "NODE_JS = [os.path.expanduser('~/node-v19.0.0-linux-x64/bin/node')]" >> ~/emsdk/.emscripten
83+
version=<< parameters.node_version >>
84+
wget https://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.xz
85+
tar xf node-v${version}-linux-x64.tar.xz
86+
echo "NODE_JS = [os.path.expanduser('~/node-v${version}-linux-x64/bin/node')]" >> ~/emsdk/.emscripten
8287
echo "JS_ENGINES = [NODE_JS]" >> ~/emsdk/.emscripten
8388
echo "if os.path.exists(V8_ENGINE[0]): JS_ENGINES.append(V8_ENGINE)" >> ~/emsdk/.emscripten
8489
cat ~/emsdk/.emscripten
85-
echo "export PATH=\"$HOME/node-v19.0.0-linux-x64/bin:\$PATH\"" >> $BASH_ENV
90+
echo "export PATH=\"$HOME/node-v${version}-linux-x64/bin:\$PATH\"" >> $BASH_ENV
91+
install-latest-node:
92+
description: "install latest version of node"
93+
steps:
94+
- install-node-version:
95+
node_version: "19.0.0"
8696
install-v8:
8797
description: "install v8 using jsvu"
8898
steps:
@@ -508,11 +518,11 @@ jobs:
508518
test_targets: "wasm64_v8"
509519
- run-tests:
510520
test_targets: "wasm64l"
511-
- setup-latest-node
521+
- install-latest-node
512522
- run-tests:
513523
test_targets: "wasm64"
514524
- upload-test-results
515-
test-latest-node:
525+
test-node-compat:
516526
# We don't use `bionic` here since its tool old to run recent node versions:
517527
# `/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found`
518528
executor: linux-python
@@ -523,10 +533,17 @@ jobs:
523533
command: git submodule update --init
524534
- pip-install
525535
- build
526-
- setup-latest-node
536+
# Run some basic tests with the minimum version of node that we currently
537+
# support.
538+
- install-node-version:
539+
node_version: "10.19.0"
540+
- run-tests:
541+
test_targets: "core2.test_hello_world"
542+
# Run a few test with the most recent version of node
543+
# In particular we have some tests that require node flags on older
544+
# versions of node but not with the most recent version.
545+
- install-latest-node
527546
- run-tests:
528-
# Run tests that on older versions of node would require flags, but
529-
# those flags should not be injected on newer versions.
530547
test_targets: "-v core2.test_pthread_create core2.test_i64_invoke_bigint core2.test_source_map"
531548
- upload-test-results
532549
test-other:
@@ -703,7 +720,7 @@ workflows:
703720
- test-sockets-chrome:
704721
requires:
705722
- build-linux
706-
- test-latest-node
723+
- test-node-compat
707724
- test-windows
708725
- test-mac:
709726
# The mac tester also uses the libraries built on the linux builder to

src/parseTools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Tests live in test/other/test_parseTools.js.
99
*/
1010

11-
globalThis.FOUR_GB = 4 * 1024 * 1024 * 1024;
11+
global.FOUR_GB = 4 * 1024 * 1024 * 1024;
1212
const FLOAT_TYPES = new Set(['float', 'double']);
1313

1414
let currentlyParsedFilename = '';

test/common.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,22 @@ def setUp(self):
519519
self.settings_mods = {}
520520
self.emcc_args = ['-Wclosure', '-Werror', '-Wno-limited-postlink-optimizations']
521521
self.ldflags = []
522-
self.node_args = [
523-
# Increate stack trace limit to maximise usefulness of test failure reports
524-
'--stack-trace-limit=50',
525-
# Opt in to node v15 default behaviour:
526-
# https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
527-
'--unhandled-rejections=throw',
528-
# Include backtrace for all uncuaght exceptions (not just Error).
529-
'--trace-uncaught',
530-
]
522+
# Increate stack trace limit to maximise usefulness of test failure reports
523+
self.node_args = ['--stack-trace-limit=50']
524+
525+
node_version = shared.check_node_version()
526+
if node_version:
527+
if node_version < (11, 0, 0):
528+
self.node_args.append('--unhandled-rejections=strict')
529+
self.node_args.append('--experimental-wasm-se')
530+
else:
531+
# Include backtrace for all uncuaght exceptions (not just Error).
532+
self.node_args.append('--trace-uncaught')
533+
if node_version < (15, 0, 0):
534+
# Opt in to node v15 default behaviour:
535+
# https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
536+
self.node_args.append('--unhandled-rejections=throw')
537+
531538
self.v8_args = ['--wasm-staging']
532539
self.env = {}
533540
self.temp_files_before_run = []

test/test_sanity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@ def test_node(self):
280280

281281
for version, succeed in [('v0.8.0', False),
282282
('v4.1.0', False),
283-
('v4.1.1', True),
284-
('v4.2.3-pre', True),
283+
('v10.18.0', False),
284+
('v10.19.0', True),
285+
('v10.19.1-pre', True),
285286
('cheez', False)]:
286287
print(version, succeed)
287288
delete_file(SANITY_FILE)

tools/shared.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545

4646

4747
DEBUG_SAVE = DEBUG or int(os.environ.get('EMCC_DEBUG_SAVE', '0'))
48-
MINIMUM_NODE_VERSION = (4, 1, 1)
48+
# Minimum node version required to run the emscripten compiler. This is distinct
49+
# from the minimum version required to execute the generated code. This is not an
50+
# exact requirement, but is the oldest version of node that we do any testing with.
51+
# This version aligns with the current Ubuuntu TLS 20.04 (Focal).
52+
MINIMUM_NODE_VERSION = (10, 19, 0)
4953
EXPECTED_LLVM_VERSION = "16.0"
5054

5155
# Used only when EM_PYTHON_MULTIPROCESSING=1 env. var is set.

0 commit comments

Comments
 (0)