summaryrefslogtreecommitdiff
path: root/tests/integration/mod.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-02-10 13:22:13 -0700
committerGitHub <noreply@github.com>2024-02-10 20:22:13 +0000
commitf5e46c9bf2f50d66a953fa133161fc829cecff06 (patch)
tree8faf2f5831c1c7b11d842cd9908d141082c869a5 /tests/integration/mod.rs
parentd2477f780630a812bfd65e3987b70c0d309385bb (diff)
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit.
Diffstat (limited to 'tests/integration/mod.rs')
-rw-r--r--tests/integration/mod.rs158
1 files changed, 158 insertions, 0 deletions
diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs
new file mode 100644
index 000000000..19796f245
--- /dev/null
+++ b/tests/integration/mod.rs
@@ -0,0 +1,158 @@
+// 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
+
+#[path = "bench_tests.rs"]
+mod bench;
+#[path = "bundle_tests.rs"]
+mod bundle;
+#[path = "cache_tests.rs"]
+mod cache;
+#[path = "cert_tests.rs"]
+mod cert;
+#[path = "check_tests.rs"]
+mod check;
+#[path = "compile_tests.rs"]
+mod compile;
+#[path = "coverage_tests.rs"]
+mod coverage;
+#[path = "doc_tests.rs"]
+mod doc;
+#[path = "eval_tests.rs"]
+mod eval;
+#[path = "flags_tests.rs"]
+mod flags;
+#[path = "fmt_tests.rs"]
+mod fmt;
+#[path = "info_tests.rs"]
+mod info;
+#[path = "init_tests.rs"]
+mod init;
+#[path = "inspector_tests.rs"]
+mod inspector;
+#[path = "install_tests.rs"]
+mod install;
+#[path = "js_unit_tests.rs"]
+mod js_unit_tests;
+#[path = "jsr_tests.rs"]
+mod jsr;
+#[path = "jupyter_tests.rs"]
+mod jupyter;
+#[path = "lint_tests.rs"]
+mod lint;
+#[path = "lsp_tests.rs"]
+mod lsp;
+#[path = "node_compat_tests.rs"]
+mod node_compat_tests;
+#[path = "node_unit_tests.rs"]
+mod node_unit_tests;
+#[path = "npm_tests.rs"]
+mod npm;
+#[path = "publish_tests.rs"]
+mod publish;
+
+#[path = "repl_tests.rs"]
+mod repl;
+#[path = "run_tests.rs"]
+mod run;
+#[path = "shared_library_tests.rs"]
+mod shared_library_tests;
+#[path = "task_tests.rs"]
+mod task;
+#[path = "test_tests.rs"]
+mod test;
+#[path = "upgrade_tests.rs"]
+mod upgrade;
+#[path = "vendor_tests.rs"]
+mod vendor;
+#[path = "watcher_tests.rs"]
+mod watcher;
+#[path = "worker_tests.rs"]
+mod worker;