summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs22
-rw-r--r--cli/tests/x_deno_warning.js1
-rw-r--r--cli/tests/x_deno_warning.js.header2
3 files changed, 25 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 7ad7781de..4897422b9 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -13,6 +13,28 @@ use std::process::Command;
use tempfile::TempDir;
#[test]
+fn x_deno_warning() {
+ let g = util::http_server();
+ let output = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("run")
+ .arg("--reload")
+ .arg("http://127.0.0.1:4545/cli/tests/x_deno_warning.js")
+ .stdout(std::process::Stdio::piped())
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap()
+ .wait_with_output()
+ .unwrap();
+ assert!(output.status.success());
+ let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim();
+ let stderr_str = std::str::from_utf8(&output.stderr).unwrap().trim();
+ assert_eq!("testing x-deno-warning header", stdout_str);
+ assert!(deno::colors::strip_ansi_codes(stderr_str).contains("Warning foobar"));
+ drop(g);
+}
+
+#[test]
fn no_color() {
let output = util::deno_cmd()
.current_dir(util::root_path())
diff --git a/cli/tests/x_deno_warning.js b/cli/tests/x_deno_warning.js
new file mode 100644
index 000000000..34b950566
--- /dev/null
+++ b/cli/tests/x_deno_warning.js
@@ -0,0 +1 @@
+console.log("testing x-deno-warning header");
diff --git a/cli/tests/x_deno_warning.js.header b/cli/tests/x_deno_warning.js.header
new file mode 100644
index 000000000..9a8ba0190
--- /dev/null
+++ b/cli/tests/x_deno_warning.js.header
@@ -0,0 +1,2 @@
+Content-Type: application/javascript
+X-Deno-Warning: foobar \ No newline at end of file