summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/integration_tests.py5
-rwxr-xr-xtools/prefetch_test.py35
-rwxr-xr-xtools/test.py3
-rw-r--r--tools/util.py1
4 files changed, 40 insertions, 4 deletions
diff --git a/tools/integration_tests.py b/tools/integration_tests.py
index 67c6852d4..86638ce3f 100755
--- a/tools/integration_tests.py
+++ b/tools/integration_tests.py
@@ -11,10 +11,7 @@ import os
import re
import sys
import subprocess
-from util import pattern_match, green_ok, red_failed
-
-root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-tests_path = os.path.join(root_path, "tests")
+from util import root_path, tests_path, pattern_match, green_ok, red_failed
def read_test(file_name):
diff --git a/tools/prefetch_test.py b/tools/prefetch_test.py
new file mode 100755
index 000000000..d6de9d398
--- /dev/null
+++ b/tools/prefetch_test.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# Copyright 2018 the Deno authors. All rights reserved. MIT license.
+import os
+import sys
+from util import tests_path, run_output, build_path, executable_suffix, green_ok
+import tempfile
+import shutil
+
+
+def prefetch_test(deno_exe):
+ sys.stdout.write("prefetch_test...")
+ sys.stdout.flush()
+
+ # On Windows, set the base directory that mkdtemp() uses explicitly. If not,
+ # it'll use the short (8.3) path to the temp dir, which triggers the error
+ # 'TS5009: Cannot find the common subdirectory path for the input files.'
+ temp_dir = os.environ["TEMP"] if os.name == 'nt' else None
+ deno_dir = tempfile.mkdtemp(dir=temp_dir)
+ try:
+ t = os.path.join(tests_path, "006_url_imports.ts")
+ output = run_output([deno_exe, "--prefetch", t],
+ merge_env={"DENO_DIR": deno_dir})
+ assert output == ""
+ # Check that we actually did the prefetch.
+ os.path.exists(
+ os.path.join(deno_dir,
+ "deps/http/localhost_PORT4545/tests/subdir/mod2.ts"))
+ finally:
+ shutil.rmtree(deno_dir)
+
+ print green_ok()
+
+
+if __name__ == "__main__":
+ prefetch_test(sys.argv[1])
diff --git a/tools/test.py b/tools/test.py
index 41e811a6d..9a0b73359 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -12,6 +12,7 @@ from unit_tests import unit_tests
from util_test import util_test
from benchmark_test import benchmark_test
from repl_test import repl_tests
+from prefetch_test import prefetch_test
import subprocess
import http_server
@@ -59,6 +60,8 @@ def main(argv):
unit_tests(deno_exe)
+ prefetch_test(deno_exe)
+
integration_tests(deno_exe)
# TODO We currently skip testing the prompt in Windows completely.
diff --git a/tools/util.py b/tools/util.py
index 368294f45..a7370950b 100644
--- a/tools/util.py
+++ b/tools/util.py
@@ -12,6 +12,7 @@ FG_GREEN = "\x1b[32m"
executable_suffix = ".exe" if os.name == "nt" else ""
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+tests_path = os.path.join(root_path, "tests")
def make_env(merge_env=None, env=None):