summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/deno_dir.rs2
-rw-r--r--src/main.rs4
-rw-r--r--tests/006_url_imports.ts.out2
-rw-r--r--tests/015_import_no_ext.ts.out3
-rw-r--r--tests/017_import_redirect.ts.out1
-rw-r--r--tests/019_media_types.ts.out8
-rw-r--r--tests/async_error.test1
-rw-r--r--tests/async_error.ts.out2
-rw-r--r--tests/error_001.test1
-rw-r--r--tests/error_001.ts.out2
-rw-r--r--tests/error_002.test1
-rw-r--r--tests/error_002.ts.out2
-rw-r--r--tests/error_004_missing_module.test1
-rw-r--r--tests/error_004_missing_module.ts.out2
-rw-r--r--tests/error_005_missing_dynamic_import.test1
-rw-r--r--tests/error_005_missing_dynamic_import.ts.out2
-rw-r--r--tests/error_006_import_ext_failure.test1
-rw-r--r--tests/error_006_import_ext_failure.ts.out2
-rw-r--r--tests/error_007_any.test1
-rw-r--r--tests/error_007_any.ts.out2
-rw-r--r--tests/https_import.ts.out1
-rwxr-xr-xtools/integration_tests.py16
-rwxr-xr-xtools/permission_prompt_test.py15
23 files changed, 37 insertions, 36 deletions
diff --git a/src/deno_dir.rs b/src/deno_dir.rs
index 6321d3a03..a3b134f84 100644
--- a/src/deno_dir.rs
+++ b/src/deno_dir.rs
@@ -141,7 +141,7 @@ impl DenoDir {
let mt = Path::new(&media_type_filename);
let src = if self.reload || !p.exists() {
- println!("Downloading {}", module_name);
+ eprintln!("Downloading {}", module_name);
let (source, content_type) = http_util::fetch_sync_string(module_name)?;
match p.parent() {
Some(ref parent) => fs::create_dir_all(parent),
diff --git a/src/main.rs b/src/main.rs
index cdb7d8dd0..bcc18511c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -72,9 +72,7 @@ impl log::Log for Logger {
}
fn print_err_and_exit(err: js_errors::JSError) {
- // TODO Currently tests depend on exception going to stdout. It should go
- // to stderr. https://github.com/denoland/deno/issues/964
- println!("{}", err.to_string());
+ eprintln!("{}", err.to_string());
std::process::exit(1);
}
diff --git a/tests/006_url_imports.ts.out b/tests/006_url_imports.ts.out
index f481ff137..989ce33e9 100644
--- a/tests/006_url_imports.ts.out
+++ b/tests/006_url_imports.ts.out
@@ -1,4 +1,2 @@
-Downloading http://localhost:4545/tests/subdir/mod2.ts
-Downloading http://localhost:4545/tests/subdir/print_hello.ts
Hello
success
diff --git a/tests/015_import_no_ext.ts.out b/tests/015_import_no_ext.ts.out
index 92f21e2a7..954e8636a 100644
--- a/tests/015_import_no_ext.ts.out
+++ b/tests/015_import_no_ext.ts.out
@@ -1,6 +1,3 @@
-Downloading http://localhost:4545/tests/subdir/mod2
-Downloading http://localhost:4545/tests/subdir/mod2.ts
-Downloading http://localhost:4545/tests/subdir/print_hello.ts
true
[Function: printHello]
[Function: printHello]
diff --git a/tests/017_import_redirect.ts.out b/tests/017_import_redirect.ts.out
index d1ec08c42..e965047ad 100644
--- a/tests/017_import_redirect.ts.out
+++ b/tests/017_import_redirect.ts.out
@@ -1,2 +1 @@
-Downloading http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts
Hello
diff --git a/tests/019_media_types.ts.out b/tests/019_media_types.ts.out
index 31f5d8de0..7b5fdd44f 100644
--- a/tests/019_media_types.ts.out
+++ b/tests/019_media_types.ts.out
@@ -1,9 +1 @@
-Downloading http://localhost:4545/tests/subdir/mt_text_typescript.t1.ts
-Downloading http://localhost:4545/tests/subdir/mt_video_vdn.t2.ts
-Downloading http://localhost:4545/tests/subdir/mt_video_mp2t.t3.ts
-Downloading http://localhost:4545/tests/subdir/mt_application_x_typescript.t4.ts
-Downloading http://localhost:4545/tests/subdir/mt_text_javascript.j1.js
-Downloading http://localhost:4545/tests/subdir/mt_application_ecmascript.j2.js
-Downloading http://localhost:4545/tests/subdir/mt_text_ecmascript.j3.js
-Downloading http://localhost:4545/tests/subdir/mt_application_x_javascript.j4.js
success true true true true true true true true
diff --git a/tests/async_error.test b/tests/async_error.test
index 6734876c5..4667f6e09 100644
--- a/tests/async_error.test
+++ b/tests/async_error.test
@@ -1,3 +1,4 @@
exit_code: 1
args: tests/async_error.ts --reload
+check_stderr: true
output: tests/async_error.ts.out
diff --git a/tests/async_error.ts.out b/tests/async_error.ts.out
index 602d76424..dd844f9a9 100644
--- a/tests/async_error.ts.out
+++ b/tests/async_error.ts.out
@@ -1,4 +1,4 @@
-hello
+[WILDCARD]hello
before error
world
Error: error
diff --git a/tests/error_001.test b/tests/error_001.test
index 549b00995..354f536d5 100644
--- a/tests/error_001.test
+++ b/tests/error_001.test
@@ -1,3 +1,4 @@
args: tests/error_001.ts --reload
+check_stderr: true
exit_code: 1
output: tests/error_001.ts.out
diff --git a/tests/error_001.ts.out b/tests/error_001.ts.out
index 7ca70a6af..b9ad7938c 100644
--- a/tests/error_001.ts.out
+++ b/tests/error_001.ts.out
@@ -1,4 +1,4 @@
-Error: bad
+[WILDCARD]Error: bad
at foo (file://[WILDCARD]tests/error_001.ts:2:9)
at bar (file://[WILDCARD]tests/error_001.ts:6:3)
at eval (file://[WILDCARD]tests/error_001.ts:9:1)
diff --git a/tests/error_002.test b/tests/error_002.test
index e7eb6c83c..e8658ad96 100644
--- a/tests/error_002.test
+++ b/tests/error_002.test
@@ -1,3 +1,4 @@
args: tests/error_002.ts --reload
+check_stderr: true
exit_code: 1
output: tests/error_002.ts.out
diff --git a/tests/error_002.ts.out b/tests/error_002.ts.out
index 88f5138f3..6ea4ede78 100644
--- a/tests/error_002.ts.out
+++ b/tests/error_002.ts.out
@@ -1,4 +1,4 @@
-Error: exception from mod1
+[WILDCARD]Error: exception from mod1
at throwsError (file://[WILDCARD]/tests/subdir/mod1.ts:16:9)
at foo (file://[WILDCARD]/tests/error_002.ts:4:3)
at eval (file://[WILDCARD]/tests/error_002.ts:7:1)
diff --git a/tests/error_004_missing_module.test b/tests/error_004_missing_module.test
index 6f584e56a..b94c86004 100644
--- a/tests/error_004_missing_module.test
+++ b/tests/error_004_missing_module.test
@@ -1,3 +1,4 @@
args: tests/error_004_missing_module.ts --reload
+check_stderr: true
exit_code: 1
output: tests/error_004_missing_module.ts.out
diff --git a/tests/error_004_missing_module.ts.out b/tests/error_004_missing_module.ts.out
index e78692489..a15b65653 100644
--- a/tests/error_004_missing_module.ts.out
+++ b/tests/error_004_missing_module.ts.out
@@ -1,4 +1,4 @@
-NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_004_missing_module.ts"
+[WILDCARD]NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_004_missing_module.ts"
at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])
diff --git a/tests/error_005_missing_dynamic_import.test b/tests/error_005_missing_dynamic_import.test
index 826b3345d..2acf467c1 100644
--- a/tests/error_005_missing_dynamic_import.test
+++ b/tests/error_005_missing_dynamic_import.test
@@ -1,3 +1,4 @@
args: tests/error_005_missing_dynamic_import.ts --reload
+check_stderr: true
exit_code: 1
output: tests/error_005_missing_dynamic_import.ts.out
diff --git a/tests/error_005_missing_dynamic_import.ts.out b/tests/error_005_missing_dynamic_import.ts.out
index 7cf79a9b4..f59d19034 100644
--- a/tests/error_005_missing_dynamic_import.ts.out
+++ b/tests/error_005_missing_dynamic_import.ts.out
@@ -1,4 +1,4 @@
-NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_005_missing_dynamic_import.ts"
+[WILDCARD]NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_005_missing_dynamic_import.ts"
at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])
diff --git a/tests/error_006_import_ext_failure.test b/tests/error_006_import_ext_failure.test
index 90a625a17..5fe245739 100644
--- a/tests/error_006_import_ext_failure.test
+++ b/tests/error_006_import_ext_failure.test
@@ -1,3 +1,4 @@
args: tests/error_006_import_ext_failure.ts --reload
+check_stderr: true
exit_code: 1
output: tests/error_006_import_ext_failure.ts.out
diff --git a/tests/error_006_import_ext_failure.ts.out b/tests/error_006_import_ext_failure.ts.out
index aa56cc316..3c07bee70 100644
--- a/tests/error_006_import_ext_failure.ts.out
+++ b/tests/error_006_import_ext_failure.ts.out
@@ -1,4 +1,4 @@
-NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_006_import_ext_failure.ts"
+[WILDCARD]NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_006_import_ext_failure.ts"
at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])
diff --git a/tests/error_007_any.test b/tests/error_007_any.test
index 2c63c932a..970049195 100644
--- a/tests/error_007_any.test
+++ b/tests/error_007_any.test
@@ -1,3 +1,4 @@
args: tests/error_007_any.ts --reload
+check_stderr: true
exit_code: 1
output: tests/error_007_any.ts.out
diff --git a/tests/error_007_any.ts.out b/tests/error_007_any.ts.out
index 5bf110299..068b4b474 100644
--- a/tests/error_007_any.ts.out
+++ b/tests/error_007_any.ts.out
@@ -1 +1 @@
-[object Object]
+[WILDCARD][object Object]
diff --git a/tests/https_import.ts.out b/tests/https_import.ts.out
index efc3fd543..e965047ad 100644
--- a/tests/https_import.ts.out
+++ b/tests/https_import.ts.out
@@ -1,2 +1 @@
-Downloading https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts
Hello
diff --git a/tools/integration_tests.py b/tools/integration_tests.py
index 95c670f61..67c6852d4 100755
--- a/tools/integration_tests.py
+++ b/tools/integration_tests.py
@@ -28,6 +28,15 @@ def read_test(file_name):
return test_dict
+def str2bool(v):
+ if v == "true":
+ return True
+ elif v == "false":
+ return False
+ else:
+ raise ValueError("Bad boolean value")
+
+
def integration_tests(deno_executable):
assert os.path.isfile(deno_executable)
tests = sorted([
@@ -40,6 +49,10 @@ def integration_tests(deno_executable):
test = read_test(test_abs)
exit_code = int(test.get("exit_code", 0))
args = test.get("args", "").split(" ")
+
+ check_stderr = str2bool(test.get("check_stderr", "false"))
+ stderr = subprocess.STDOUT if check_stderr else None
+
output_abs = os.path.join(root_path, test.get("output", ""))
with open(output_abs, 'r') as f:
expected_out = f.read()
@@ -48,7 +61,8 @@ def integration_tests(deno_executable):
print " ".join(cmd)
actual_code = 0
try:
- actual_out = subprocess.check_output(cmd, universal_newlines=True)
+ actual_out = subprocess.check_output(
+ cmd, universal_newlines=True, stderr=stderr)
except subprocess.CalledProcessError as e:
actual_code = e.returncode
actual_out = e.output
diff --git a/tools/permission_prompt_test.py b/tools/permission_prompt_test.py
index 7f0ae1c97..9a450143c 100755
--- a/tools/permission_prompt_test.py
+++ b/tools/permission_prompt_test.py
@@ -79,10 +79,9 @@ class Prompt(object):
assert stderr == b''
def test_write_no(self):
- code, stdout, stderr = self.run('needsWrite', b'N\n')
+ code, _stdout, stderr = self.run('needsWrite', b'N\n')
assert code == 1
- # FIXME this error message should be in stderr
- assert b'PermissionDenied: permission denied' in stdout
+ assert b'PermissionDenied: permission denied' in stderr
assert b'Deno requests write access' in stderr
def test_env_yes(self):
@@ -98,10 +97,9 @@ class Prompt(object):
assert stderr == b''
def test_env_no(self):
- code, stdout, stderr = self.run('needsEnv', b'N\n')
+ code, _stdout, stderr = self.run('needsEnv', b'N\n')
assert code == 1
- # FIXME this error message should be in stderr
- assert b'PermissionDenied: permission denied' in stdout
+ assert b'PermissionDenied: permission denied' in stderr
assert b'Deno requests access to environment' in stderr
def test_net_yes(self):
@@ -117,10 +115,9 @@ class Prompt(object):
assert stderr == b''
def test_net_no(self):
- code, stdout, stderr = self.run('needsNet', b'N\n')
+ code, _stdout, stderr = self.run('needsNet', b'N\n')
assert code == 1
- # FIXME this error message should be in stderr
- assert b'PermissionDenied: permission denied' in stdout
+ assert b'PermissionDenied: permission denied' in stderr
assert b'Deno requests network access' in stderr