summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Cargo.toml7
-rw-r--r--tests/README.md1
-rw-r--r--tests/integration/bench_tests.rs2
-rw-r--r--tests/integration/bundle_tests.rs1
-rw-r--r--tests/integration/cache_tests.rs1
-rw-r--r--tests/integration/cert_tests.rs2
-rw-r--r--tests/integration/check_tests.rs1
-rw-r--r--tests/integration/coverage_tests.rs1
-rw-r--r--tests/integration/doc_tests.rs1
-rw-r--r--tests/integration/eval_tests.rs1
-rw-r--r--tests/integration/flags_tests.rs1
-rw-r--r--tests/integration/fmt_tests.rs1
-rw-r--r--tests/integration/info_tests.rs1
-rw-r--r--tests/integration/js_unit_tests.rs1
-rw-r--r--tests/integration/jsr_tests.rs1
-rw-r--r--tests/integration/jupyter_tests.rs2
-rw-r--r--tests/integration/lint_tests.rs1
-rw-r--r--tests/integration/mod.rs85
-rw-r--r--tests/integration/node_compat_tests.rs21
-rw-r--r--tests/integration/node_unit_tests.rs2
-rw-r--r--tests/integration/npm_tests.rs1
-rw-r--r--tests/integration/publish_tests.rs1
-rw-r--r--tests/integration/run_tests.rs2
-rw-r--r--tests/integration/task_tests.rs1
-rw-r--r--tests/integration/test_tests.rs1
-rw-r--r--tests/integration/vendor_tests.rs1
-rw-r--r--tests/integration/worker_tests.rs2
-rw-r--r--tests/integration_tests.rs7
-rw-r--r--tests/integration_tests_runner.rs18
-rw-r--r--tests/node_compat/test_runner.rs23
30 files changed, 60 insertions, 131 deletions
diff --git a/tests/Cargo.toml b/tests/Cargo.toml
index 578aaf47b..ffef6eb2d 100644
--- a/tests/Cargo.toml
+++ b/tests/Cargo.toml
@@ -17,7 +17,12 @@ run = []
[[test]]
name = "integration_tests"
-path = "integration_tests.rs"
+path = "integration/mod.rs"
+required-features = ["run"]
+
+[[test]]
+name = "node_compat_tests"
+path = "node_compat/test_runner.rs"
required-features = ["run"]
[dev-dependencies]
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 000000000..58aceaa87
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1 @@
+# Deno Integration Tests
diff --git a/tests/integration/bench_tests.rs b/tests/integration/bench_tests.rs
index f92006eb9..8621679dc 100644
--- a/tests/integration/bench_tests.rs
+++ b/tests/integration/bench_tests.rs
@@ -2,6 +2,8 @@
use deno_core::url::Url;
use test_util as util;
+use test_util::itest;
+use test_util::itest_flaky;
use util::assert_contains;
use util::assert_not_contains;
use util::env_vars_for_npm_tests;
diff --git a/tests/integration/bundle_tests.rs b/tests/integration/bundle_tests.rs
index 08e3fb06a..836a692b6 100644
--- a/tests/integration/bundle_tests.rs
+++ b/tests/integration/bundle_tests.rs
@@ -3,6 +3,7 @@
use test_util as util;
use test_util::assert_contains;
use test_util::assert_ends_with;
+use test_util::itest;
use test_util::TempDir;
#[test]
diff --git a/tests/integration/cache_tests.rs b/tests/integration/cache_tests.rs
index 2aa0f9d8b..d5b4e8844 100644
--- a/tests/integration/cache_tests.rs
+++ b/tests/integration/cache_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util::env_vars_for_npm_tests;
+use test_util::itest;
use test_util::TestContext;
use test_util::TestContextBuilder;
diff --git a/tests/integration/cert_tests.rs b/tests/integration/cert_tests.rs
index 9e89a9f3e..abdf9fe46 100644
--- a/tests/integration/cert_tests.rs
+++ b/tests/integration/cert_tests.rs
@@ -8,6 +8,8 @@ use std::io::Cursor;
use std::io::Read;
use std::sync::Arc;
use test_util as util;
+use test_util::itest;
+use test_util::itest_flaky;
use url::Url;
use util::testdata_path;
use util::TestContext;
diff --git a/tests/integration/check_tests.rs b/tests/integration/check_tests.rs
index f836957ce..d4d996b00 100644
--- a/tests/integration/check_tests.rs
+++ b/tests/integration/check_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
+use test_util::itest;
use util::env_vars_for_npm_tests;
use util::TestContext;
use util::TestContextBuilder;
diff --git a/tests/integration/coverage_tests.rs b/tests/integration/coverage_tests.rs
index 804f9b578..5353996a0 100644
--- a/tests/integration/coverage_tests.rs
+++ b/tests/integration/coverage_tests.rs
@@ -3,6 +3,7 @@
use deno_core::serde_json;
use std::fs;
use test_util as util;
+use test_util::itest;
use test_util::TempDir;
use util::assert_starts_with;
use util::env_vars_for_npm_tests;
diff --git a/tests/integration/doc_tests.rs b/tests/integration/doc_tests.rs
index 62fd2a5b4..ca523f07f 100644
--- a/tests/integration/doc_tests.rs
+++ b/tests/integration/doc_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
+use test_util::itest;
use util::assert_contains;
use util::TestContext;
diff --git a/tests/integration/eval_tests.rs b/tests/integration/eval_tests.rs
index 1ae65e49e..3f4c6a3a6 100644
--- a/tests/integration/eval_tests.rs
+++ b/tests/integration/eval_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
+use test_util::itest;
#[test]
fn eval_p() {
diff --git a/tests/integration/flags_tests.rs b/tests/integration/flags_tests.rs
index a22cb0548..c898c199c 100644
--- a/tests/integration/flags_tests.rs
+++ b/tests/integration/flags_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
+use test_util::itest;
use util::assert_contains;
#[test]
diff --git a/tests/integration/fmt_tests.rs b/tests/integration/fmt_tests.rs
index 94eca295e..6588ae10a 100644
--- a/tests/integration/fmt_tests.rs
+++ b/tests/integration/fmt_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
+use test_util::itest;
use util::assert_contains;
use util::PathRef;
use util::TestContext;
diff --git a/tests/integration/info_tests.rs b/tests/integration/info_tests.rs
index 922fcee06..c3de0e470 100644
--- a/tests/integration/info_tests.rs
+++ b/tests/integration/info_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
+use test_util::itest;
use util::env_vars_for_npm_tests;
use util::TestContextBuilder;
diff --git a/tests/integration/js_unit_tests.rs b/tests/integration/js_unit_tests.rs
index de7108d25..d96af78d8 100644
--- a/tests/integration/js_unit_tests.rs
+++ b/tests/integration/js_unit_tests.rs
@@ -1,4 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
use std::io::BufRead;
use std::io::BufReader;
use std::time::Duration;
diff --git a/tests/integration/jsr_tests.rs b/tests/integration/jsr_tests.rs
index 2de4f0056..51cfcfaac 100644
--- a/tests/integration/jsr_tests.rs
+++ b/tests/integration/jsr_tests.rs
@@ -3,6 +3,7 @@
use deno_core::serde_json::Value;
use deno_lockfile::Lockfile;
use test_util as util;
+use test_util::itest;
use url::Url;
use util::env_vars_for_jsr_tests;
use util::TestContextBuilder;
diff --git a/tests/integration/jupyter_tests.rs b/tests/integration/jupyter_tests.rs
index 59c247e5d..547861258 100644
--- a/tests/integration/jupyter_tests.rs
+++ b/tests/integration/jupyter_tests.rs
@@ -1,5 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+use test_util::itest;
+
itest!(jupyter_install_command_not_exists {
args: "jupyter --install",
output: "jupyter/install_command_not_exists.out",
diff --git a/tests/integration/lint_tests.rs b/tests/integration/lint_tests.rs
index b266fb5b7..f7c9ead36 100644
--- a/tests/integration/lint_tests.rs
+++ b/tests/integration/lint_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util::assert_contains;
+use test_util::itest;
use test_util::TestContextBuilder;
itest!(ignore_unexplicit_files {
diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs
index 19796f245..89a66385e 100644
--- a/tests/integration/mod.rs
+++ b/tests/integration/mod.rs
@@ -1,90 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-#[macro_export]
-macro_rules! itest(
-($name:ident {$( $key:ident: $value:expr,)*}) => {
- #[test]
- fn $name() {
- let test = test_util::CheckOutputIntegrationTest {
- $(
- $key: $value,
- )*
- .. Default::default()
- };
- let output = test.output();
- output.assert_exit_code(test.exit_code);
- if !test.output.is_empty() {
- assert!(test.output_str.is_none());
- output.assert_matches_file(test.output);
- } else {
- output.assert_matches_text(test.output_str.unwrap_or(""));
- }
- }
-}
-);
-
-#[macro_export]
-macro_rules! itest_flaky(
-($name:ident {$( $key:ident: $value:expr,)*}) => {
- #[flaky_test::flaky_test]
- fn $name() {
- let test = test_util::CheckOutputIntegrationTest {
- $(
- $key: $value,
- )*
- .. Default::default()
- };
- let output = test.output();
- output.assert_exit_code(test.exit_code);
- if !test.output.is_empty() {
- assert!(test.output_str.is_none());
- output.assert_matches_file(test.output);
- } else {
- output.assert_matches_text(test.output_str.unwrap_or(""));
- }
- }
-}
-);
-
-#[macro_export]
-macro_rules! context(
-({$( $key:ident: $value:expr,)*}) => {
- test_util::TestContext::create(test_util::TestContextOptions {
- $(
- $key: $value,
- )*
- .. Default::default()
- })
-}
-);
-
-#[macro_export]
-macro_rules! itest_steps(
-($name:ident {$( $key:ident: $value:expr,)*}) => {
- #[test]
- fn $name() {
- (test_util::CheckOutputIntegrationTestSteps {
- $(
- $key: $value,
- )*
- .. Default::default()
- }).run()
- }
-}
-);
-
-#[macro_export]
-macro_rules! command_step(
-({$( $key:ident: $value:expr,)*}) => {
- test_util::CheckOutputIntegrationTestCommandStep {
- $(
- $key: $value,
- )*
- .. Default::default()
- }
-}
-);
-
// These files have `_tests.rs` suffix to make it easier to tell which file is
// the test (ex. `lint_tests.rs`) and which is the implementation (ex. `lint.rs`)
// when both are open, especially for two tabs in VS Code
diff --git a/tests/integration/node_compat_tests.rs b/tests/integration/node_compat_tests.rs
index e2b3c219c..767f23460 100644
--- a/tests/integration/node_compat_tests.rs
+++ b/tests/integration/node_compat_tests.rs
@@ -1,28 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use test_util as util;
-use util::deno_config_path;
+use test_util::itest;
use util::env_vars_for_npm_tests;
-#[test]
-fn node_compat_tests() {
- let mut deno = util::deno_cmd()
- .current_dir(util::root_path())
- .arg("test")
- .arg("--config")
- .arg(deno_config_path())
- .arg("--no-lock")
- .arg("--unstable")
- .arg("-A")
- .arg(util::tests_path().join("node_compat"))
- .spawn()
- .expect("failed to spawn script");
-
- let status = deno.wait().expect("failed to wait for the child process");
- assert_eq!(Some(0), status.code());
- assert!(status.success());
-}
-
itest!(node_test_module {
args: "test node/test.js",
output: "node/test.out",
diff --git a/tests/integration/node_unit_tests.rs b/tests/integration/node_unit_tests.rs
index 7c5976bf6..3c824b6b2 100644
--- a/tests/integration/node_unit_tests.rs
+++ b/tests/integration/node_unit_tests.rs
@@ -1,9 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
use std::io::BufRead;
use std::io::BufReader;
use std::time::Duration;
use std::time::Instant;
use test_util as util;
+use test_util::itest;
use util::deno_config_path;
use util::env_vars_for_npm_tests;
diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs
index a63253260..3777bfe8a 100644
--- a/tests/integration/npm_tests.rs
+++ b/tests/integration/npm_tests.rs
@@ -5,6 +5,7 @@ use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use pretty_assertions::assert_eq;
use test_util as util;
+use test_util::itest;
use util::assert_contains;
use util::env_vars_for_npm_tests;
use util::http_server;
diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs
index 330a7692b..2dbd854a7 100644
--- a/tests/integration/publish_tests.rs
+++ b/tests/integration/publish_tests.rs
@@ -5,6 +5,7 @@ use test_util::assert_contains;
use test_util::assert_not_contains;
use test_util::env_vars_for_jsr_tests;
use test_util::env_vars_for_npm_tests;
+use test_util::itest;
use test_util::TestContextBuilder;
itest!(no_token {
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs
index eab7b10ba..c9508594c 100644
--- a/tests/integration/run_tests.rs
+++ b/tests/integration/run_tests.rs
@@ -11,6 +11,7 @@ use std::process::Command;
use std::process::Stdio;
use std::time::Duration;
use test_util as util;
+use test_util::itest;
use test_util::TempDir;
use trust_dns_client::serialize::txt::Lexer;
use trust_dns_client::serialize::txt::Parser;
@@ -2652,6 +2653,7 @@ fn dont_cache_on_check_fail() {
mod permissions {
use test_util as util;
+ use test_util::itest;
use util::TestContext;
// TODO(bartlomieju): remove --unstable once Deno.Command is stabilized
diff --git a/tests/integration/task_tests.rs b/tests/integration/task_tests.rs
index c8531c13f..b64e329a5 100644
--- a/tests/integration/task_tests.rs
+++ b/tests/integration/task_tests.rs
@@ -5,6 +5,7 @@
use deno_core::serde_json::json;
use test_util::env_vars_for_npm_tests;
+use test_util::itest;
use test_util::TestContext;
use test_util::TestContextBuilder;
diff --git a/tests/integration/test_tests.rs b/tests/integration/test_tests.rs
index 27bef8007..2984941cd 100644
--- a/tests/integration/test_tests.rs
+++ b/tests/integration/test_tests.rs
@@ -2,6 +2,7 @@
use deno_core::url::Url;
use test_util as util;
+use test_util::itest;
use util::assert_contains;
use util::assert_not_contains;
use util::env_vars_for_npm_tests;
diff --git a/tests/integration/vendor_tests.rs b/tests/integration/vendor_tests.rs
index c38fb653a..ab1119fe8 100644
--- a/tests/integration/vendor_tests.rs
+++ b/tests/integration/vendor_tests.rs
@@ -6,6 +6,7 @@ use pretty_assertions::assert_eq;
use std::fmt::Write as _;
use std::path::PathBuf;
use test_util as util;
+use test_util::itest;
use test_util::TempDir;
use util::http_server;
use util::new_deno_dir;
diff --git a/tests/integration/worker_tests.rs b/tests/integration/worker_tests.rs
index e2d1ef868..7b1bddead 100644
--- a/tests/integration/worker_tests.rs
+++ b/tests/integration/worker_tests.rs
@@ -1,5 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+use test_util::itest;
+
itest!(worker_error {
args: "run -A workers/worker_error.ts",
output: "workers/worker_error.ts.out",
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
deleted file mode 100644
index 8469b5416..000000000
--- a/tests/integration_tests.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-
-// The tests exist in a sub folder instead of as separate files in
-// this directory so that cargo doesn't compile each file as a new crate.
-
-#[cfg(test)]
-mod integration;
diff --git a/tests/integration_tests_runner.rs b/tests/integration_tests_runner.rs
deleted file mode 100644
index 12e83a019..000000000
--- a/tests/integration_tests_runner.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-pub fn main() {
- let mut args = vec!["cargo", "test", "-p", "cli_tests", "--features", "run"];
-
- if !cfg!(debug_assertions) {
- args.push("--release");
- }
-
- args.push("--");
-
- // If any args were passed to this process, pass them through to the child
- let orig_args = std::env::args().skip(1).collect::<Vec<_>>();
- let orig_args: Vec<&str> =
- orig_args.iter().map(|x| x.as_ref()).collect::<Vec<_>>();
- args.extend(orig_args);
-
- test_util::spawn::exec_replace("cargo", &args).unwrap();
-}
diff --git a/tests/node_compat/test_runner.rs b/tests/node_compat/test_runner.rs
new file mode 100644
index 000000000..e17c2b373
--- /dev/null
+++ b/tests/node_compat/test_runner.rs
@@ -0,0 +1,23 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
+use test_util as util;
+use util::deno_config_path;
+
+#[test]
+fn node_compat_tests() {
+ let mut deno = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("test")
+ .arg("--config")
+ .arg(deno_config_path())
+ .arg("--no-lock")
+ .arg("--unstable")
+ .arg("-A")
+ .arg(util::tests_path().join("node_compat"))
+ .spawn()
+ .expect("failed to spawn script");
+
+ let status = deno.wait().expect("failed to wait for the child process");
+ assert_eq!(Some(0), status.code());
+ assert!(status.success());
+}