aboutsummaryrefslogtreecommitdiff
path: root/test/run-tests.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-03-04 04:50:00 +0800
committerGitHub <noreply@github.com>2018-03-04 04:50:00 +0800
commit798fc21530cf15049767af1e38aeae04f81ec5e2 (patch)
tree421d8ba53c6fc5c79ed090e329d90f4398068d6c /test/run-tests.js
parenta75a046abbc1f93fbb2235c99a1fc1d543faf9e9 (diff)
downloadtracifyjs-798fc21530cf15049767af1e38aeae04f81ec5e2.tar.gz
tracifyjs-798fc21530cf15049767af1e38aeae04f81ec5e2.zip
improve `test/run-test.js` performance (#2971)
- allow reuse of contextified sandbox - minimise bottleneck from `vm.createContext()`
Diffstat (limited to 'test/run-tests.js')
-rwxr-xr-xtest/run-tests.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/run-tests.js b/test/run-tests.js
index d3238370..dcc7cc1e 100755
--- a/test/run-tests.js
+++ b/test/run-tests.js
@@ -182,7 +182,7 @@ function run_compress_tests() {
}
if (test.expect_stdout
&& (!test.node_version || semver.satisfies(process.version, test.node_version))) {
- var stdout = sandbox.run_code(input_code);
+ var stdout = sandbox.run_code(input_code, true);
if (test.expect_stdout === true) {
test.expect_stdout = stdout;
}
@@ -196,7 +196,7 @@ function run_compress_tests() {
});
return false;
}
- stdout = sandbox.run_code(output);
+ stdout = sandbox.run_code(output, true);
if (!sandbox.same_stdout(test.expect_stdout, stdout)) {
log("!!! failed\n---INPUT---\n{input}\n---EXPECTED {expected_type}---\n{expected}\n---ACTUAL {actual_type}---\n{actual}\n\n", {
input: input_formatted,
@@ -378,7 +378,7 @@ function reminify(orig_options, input_code, input_formatted, expect_stdout) {
});
return false;
} else {
- var stdout = sandbox.run_code(result.code);
+ var stdout = sandbox.run_code(result.code, true);
if (typeof expect_stdout != "string" && typeof stdout != "string" && expect_stdout.name == stdout.name) {
stdout = expect_stdout;
}