Skip to content

Commit 59f2a81

Browse files
committed
Update MINIMUM_NODE_VERSION to 10.19.0 and add testing
1 parent 954971d commit 59f2a81

File tree

5 files changed

+50
-19
lines changed

5 files changed

+50
-19
lines changed

.circleci/config.yml

Lines changed: 27 additions & 11 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 speific 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:
@@ -511,11 +521,11 @@ jobs:
511521
test_targets: "wasm64_v8"
512522
- run-tests:
513523
test_targets: "wasm64l"
514-
- setup-latest-node
524+
- install-latest-node
515525
- run-tests:
516526
test_targets: "wasm64"
517527
- upload-test-results
518-
test-latest-node:
528+
test-node-compat:
519529
# We don't use `bionic` here since its tool old to run recent node versions:
520530
# `/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found`
521531
executor: linux-python
@@ -526,7 +536,13 @@ jobs:
526536
command: git submodule update --init
527537
- pip-install
528538
- build
529-
- setup-latest-node
539+
- install-node-version:
540+
node_version: "10.19.0"
541+
- run-tests:
542+
# Run some basic tests to ensure JS compiler and other tools run
543+
# on this older version.
544+
test_targets: "core2.test_hello_world"
545+
- install-latest-node
530546
- run-tests:
531547
# Run tests that on older versions of node would require flags, but
532548
# those flags should not be injected on newer versions.
@@ -706,7 +722,7 @@ workflows:
706722
- test-sockets-chrome:
707723
requires:
708724
- build-linux
709-
- test-latest-node
725+
- test-node-compat
710726
- test-windows
711727
- test-mac:
712728
# 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: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,22 @@ def setUp(self):
522522
self.node_args = [
523523
# Increate stack trace limit to maximise usefulness of test failure reports
524524
'--stack-trace-limit=50',
525-
# Opt in to node v15 default behaviour:
526-
# https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
527525
'--unhandled-rejections=throw',
528-
# Include backtrace for all uncuaght exceptions (not just Error).
529-
'--trace-uncaught',
530526
]
527+
528+
node_version = shared.check_node_version()
529+
if node_version:
530+
if node_version < (11, 0, 0):
531+
self.node_args.append('--unhandled-rejections=strict')
532+
self.node_args.append('--experimental-wasm-se')
533+
else:
534+
# Include backtrace for all uncuaght exceptions (not just Error).
535+
self.node_args.append('--trace-uncaught')
536+
if node_version < (15, 0, 0):
537+
# Opt in to node v15 default behaviour:
538+
# https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
539+
self.node_args.append('--unhandled-rejections=strict')
540+
531541
self.v8_args = []
532542
self.env = {}
533543
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 distict
49+
# from minimum version of node required to execute the generted code.
50+
# This is not a hard requirement, but is the oldest version of node that we
51+
# any testing with. This version aligns with 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)