Rework module parsing and execution (#4462)

This patch disables automatic detection of module code, and instead
requires the user to explicitly specify whether to parse a source
as a module or as a script.

To achieve this the jerry_parse API function now takes a new option
which signals that the source should be parsed as a module.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2021-01-18 15:33:43 +01:00
committed by GitHub
parent ef8a6a9f39
commit 0fec9135ec
85 changed files with 575 additions and 492 deletions
+9 -2
View File
@@ -54,7 +54,9 @@ def get_tests(test_dir, test_list, skip_list):
if test_dir:
tests = []
for root, _, files in os.walk(test_dir):
tests.extend([os.path.join(root, test_file) for test_file in files if test_file.endswith('.js')])
for test_file in files:
if test_file.endswith('.js') or test_file.endswith('.mjs'):
tests.extend([os.path.join(root, test_file)])
if test_list:
dirname = os.path.dirname(test_list)
@@ -136,7 +138,12 @@ def run_normal_tests(args, tests):
tested += 1
test_path = os.path.relpath(test)
is_expected_to_fail = os.path.join(os.path.sep, 'fail', '') in test
(returncode, stdout) = execute_test_command(test_cmd + [test])
test_argument = []
if test.endswith('.mjs'):
test_argument.extend(['-m'])
(returncode, stdout) = execute_test_command(test_cmd + test_argument + [test])
if (returncode == 0 and not is_expected_to_fail) or (returncode == 1 and is_expected_to_fail):
passed += 1