summaryrefslogtreecommitdiff
path: root/scripts/test/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test/support.py')
-rwxr-xr-xscripts/test/support.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/test/support.py b/scripts/test/support.py
index 9d70abb7f..02d2bbfef 100755
--- a/scripts/test/support.py
+++ b/scripts/test/support.py
@@ -165,3 +165,17 @@ def run_command(cmd, expected_status=0, stderr=None,
raise Exception(('run_command unexpected stderr',
"expected '%s', actual '%s'" % (expected_err, err)))
return out
+
+
+def node_has_webassembly(cmd):
+ cmd = [cmd, '-e', 'process.stdout.write(typeof WebAssembly)']
+ return run_command(cmd) == 'object'
+
+
+def node_test_glue():
+ # running concatenated files (a.js) in node interferes with module loading
+ # because the concatenated file expects a 'var Binaryen' but binaryen.js
+ # assigned to module.exports. this is correct behavior but tests then need
+ # a workaround:
+ return ('if (typeof module === "object" && typeof exports === "object")\n'
+ ' Binaryen = module.exports;\n')