1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
denoland-deno/tools/prefetch_test.py
Bartek Iwańczuk cd19da62d9 Refactor CLI entry point (#2157)
Changes "deno --types" to "deno types"
and "deno --prefetch" to "deno prefetch"
2019-04-21 11:34:18 -04:00

30 lines
840 B
Python
Executable file

#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import os
import sys
from util import mkdtemp, tests_path, run_output, green_ok
import shutil
def prefetch_test(deno_exe):
sys.stdout.write("prefetch_test...")
sys.stdout.flush()
deno_dir = mkdtemp()
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])