diff options
author | Bradley Farias <bradley.meck@gmail.com> | 2017-06-05 19:44:56 -0500 |
---|---|---|
committer | Bradley Farias <bradley.meck@gmail.com> | 2017-09-07 15:18:32 -0500 |
commit | c8a389e19f172edbada83f59944cad7cc802d9d5 (patch) | |
tree | 15a8653683a97ff0d6b2e7f08ef8081405700ea3 /test/testpy/__init__.py | |
parent | 46133b5beba2c780fb3b9a9d6be610d09f752182 (diff) | |
download | android-node-v8-c8a389e19f172edbada83f59944cad7cc802d9d5.tar.gz android-node-v8-c8a389e19f172edbada83f59944cad7cc802d9d5.tar.bz2 android-node-v8-c8a389e19f172edbada83f59944cad7cc802d9d5.zip |
module: Allow runMain to be ESM
This follows the EPS an allows the node CLI to have ESM as an entry point.
`node ./example.mjs`. A newer V8 is needed for `import()` so that is not
included. `import.meta` is still in specification stage so that also is not
included.
PR-URL: https://github.com/nodejs/node/pull/14369
Author: Bradley Farias <bradley.meck@gmail.com>
Author: Guy Bedford <guybedford@gmail.com>
Author: Jan Krems <jan.krems@groupon.com>
Author: Timothy Gu <timothygu99@gmail.com>
Author: Michaƫl Zasso <targos@protonmail.com>
Author: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'test/testpy/__init__.py')
-rw-r--r-- | test/testpy/__init__.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index 37e5ac710b..f113c1253a 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -27,7 +27,7 @@ import test import os -from os.path import join, dirname, exists +from os.path import join, dirname, exists, splitext import re import ast @@ -109,18 +109,17 @@ class SimpleTestConfiguration(test.TestConfiguration): self.additional_flags = [] def Ls(self, path): - def SelectTest(name): - return name.startswith('test-') and name.endswith('.js') - return [f[:-3] for f in os.listdir(path) if SelectTest(f)] + return [f for f in os.listdir(path) if re.match('^test-.*\.m?js$', f)] def ListTests(self, current_path, path, arch, mode): all_tests = [current_path + [t] for t in self.Ls(join(self.root))] result = [] for test in all_tests: if self.Contains(path, test): - file_path = join(self.root, reduce(join, test[1:], "") + ".js") - result.append(SimpleTestCase(test, file_path, arch, mode, self.context, - self, self.additional_flags)) + file_path = join(self.root, reduce(join, test[1:], "")) + test_name = test[:-1] + [splitext(test[-1])[0]] + result.append(SimpleTestCase(test_name, file_path, arch, mode, + self.context, self, self.additional_flags)) return result def GetBuildRequirements(self): |